Get Control information at Mouse Position?
-
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. FireMouse_Down
event ofbtn_First
, 2.Mouse_Leave
frombtn_First
, 3. while Mouse Event ofbtn_Second
is still not released yet,Mouse_Enter
intobtn_Second
get fired, and then, get the information such like(Control)sender
isbtn_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! -
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. FireMouse_Down
event ofbtn_First
, 2.Mouse_Leave
frombtn_First
, 3. while Mouse Event ofbtn_Second
is still not released yet,Mouse_Enter
intobtn_Second
get fired, and then, get the information such like(Control)sender
isbtn_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!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!
-
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!
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
-
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
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!
-
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!