Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Events

Events

Scheduled Pinned Locked Moved C#
hardwarequestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Senkwe Chanda
    wrote on last edited by
    #1

    Hi guys, I have a control that has some picturebox controls on it. I'd like that the form on which my control is placed recieves an event notification when a picture box control recieves a MouseDown event. Simple enough but I'd like to use events. Right now I'm not sure what the code should look like. How and where do I add the parent form as a listener for an event happening within a control embedded within another control? Pseudo code will do. Regards Senkwe:omg: Just another wannabe code junky

    A 1 Reply Last reply
    0
    • S Senkwe Chanda

      Hi guys, I have a control that has some picturebox controls on it. I'd like that the form on which my control is placed recieves an event notification when a picture box control recieves a MouseDown event. Simple enough but I'd like to use events. Right now I'm not sure what the code should look like. How and where do I add the parent form as a listener for an event happening within a control embedded within another control? Pseudo code will do. Regards Senkwe:omg: Just another wannabe code junky

      A Offline
      A Offline
      Andreas Philipson
      wrote on last edited by
      #2

      Add this code to the constructor...

      this.pictureBox.MouseDown+= new System.Windows.Forms.MouseEventHandler(this.onMouseDown);

      and the function which handles the mouse down...

      private void onMouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
      {
      //do whatever...
      }

      This can be automated if you're using VS.NET... Andreas Philipson

      E 1 Reply Last reply
      0
      • A Andreas Philipson

        Add this code to the constructor...

        this.pictureBox.MouseDown+= new System.Windows.Forms.MouseEventHandler(this.onMouseDown);

        and the function which handles the mouse down...

        private void onMouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
        {
        //do whatever...
        }

        This can be automated if you're using VS.NET... Andreas Philipson

        E Offline
        E Offline
        ector
        wrote on last edited by
        #3

        how do you automate this is VS.NET??

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups