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. Get Control information at Mouse Position?

Get Control information at Mouse Position?

Scheduled Pinned Locked Moved C#
questioncsharpwinforms
5 Posts 2 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.
  • L Offline
    L Offline
    Lyon Sun
    wrote on last edited by
    #1

    Hi, all, Suppose I have two buttons in my WinForms Application, named as btn_First, btn_Second, Is it possible to do the following steps: 1. Fire Mouse_Down event of btn_First, 2. Mouse_Leave from btn_First, 3. while Mouse Event of btn_Second is still not released yet, Mouse_Enter into btn_Second get fired, and then, get the information such like (Control)sender is btn_Second, etc?? According to what I have learned so far, I think this is not possible, because two events are not supposed to get fired at the same time. But I am not so sure, just wanna ensure this(hope this is not so stupid a question ;P ). Thank you. Any suggestions would be so much appreciated!

    L 1 Reply Last reply
    0
    • L Lyon Sun

      Hi, all, Suppose I have two buttons in my WinForms Application, named as btn_First, btn_Second, Is it possible to do the following steps: 1. Fire Mouse_Down event of btn_First, 2. Mouse_Leave from btn_First, 3. while Mouse Event of btn_Second is still not released yet, Mouse_Enter into btn_Second get fired, and then, get the information such like (Control)sender is btn_Second, etc?? According to what I have learned so far, I think this is not possible, because two events are not supposed to get fired at the same time. But I am not so sure, just wanna ensure this(hope this is not so stupid a question ;P ). Thank you. Any suggestions would be so much appreciated!

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, multiple events can fire "at the same time", however they can't get handled at the same time, since all events get handled by the main thread; events get stored in the input queue and get removed from there and executed by the main thread, one by one. One handler can contain code that causes many new events to fire (i.e. be added to the queue), e.g. by executing btn.PerformClick(). :)

      Luc Pattyn


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      Local announcement (Antwerp region): Lange Wapper? Neen!


      L 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, multiple events can fire "at the same time", however they can't get handled at the same time, since all events get handled by the main thread; events get stored in the input queue and get removed from there and executed by the main thread, one by one. One handler can contain code that causes many new events to fire (i.e. be added to the queue), e.g. by executing btn.PerformClick(). :)

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        Local announcement (Antwerp region): Lange Wapper? Neen!


        L Offline
        L Offline
        Lyon Sun
        wrote on last edited by
        #3

        Hi, Thank you for your replying! ;)

        Luc Pattyn wrote:

        One handler can contain code that causes many new events to fire (i.e. be added to the queue), e.g. by executing btn.PerformClick().

        Could you be so kind to explain little bit more details about this line? Your kind help is so much appreciated! Sun

        L 1 Reply Last reply
        0
        • L Lyon Sun

          Hi, Thank you for your replying! ;)

          Luc Pattyn wrote:

          One handler can contain code that causes many new events to fire (i.e. be added to the queue), e.g. by executing btn.PerformClick().

          Could you be so kind to explain little bit more details about this line? Your kind help is so much appreciated! Sun

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          A lot of GUI operations cause multiple events to be fired, here is an example:

          public void button1_Click(object sender, EventArgs e) {
          Form2 myForm=new Form2();
          Form2.Show();

          }

          which will fire a Load, a Resize, a Shown, a Paint and many more. :)

          Luc Pattyn


          I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


          Local announcement (Antwerp region): Lange Wapper? Neen!


          L 1 Reply Last reply
          0
          • L Luc Pattyn

            A lot of GUI operations cause multiple events to be fired, here is an example:

            public void button1_Click(object sender, EventArgs e) {
            Form2 myForm=new Form2();
            Form2.Show();

            }

            which will fire a Load, a Resize, a Shown, a Paint and many more. :)

            Luc Pattyn


            I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


            Local announcement (Antwerp region): Lange Wapper? Neen!


            L Offline
            L Offline
            Lyon Sun
            wrote on last edited by
            #5

            :omg: Okay, you mean this. Thank you anyway!

            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