Please support our C# advertiser: Programming Forums
Views: 576 | Replies: 6
![]() |
•
•
Join Date: Nov 2007
Posts: 89
Reputation:
Rep Power: 2
Solved Threads: 0
i have a problem with a simple program.
my program has a label.
i tryed to add event handlers for both mouse down event
and mouse double click event.
it seems that when these two handlers are defined, only the mouse down event is responding.
the double click event simply does not respond. but when i disable the mouse down event, it works fine
my code is:
is there any way i can manage these to events to work together ?
my program has a label.
i tryed to add event handlers for both mouse down event
and mouse double click event.
it seems that when these two handlers are defined, only the mouse down event is responding.
the double click event simply does not respond. but when i disable the mouse down event, it works fine
my code is:
c# Syntax (Toggle Plain Text)
label.MouseDown += new MouseEventHandler(lab_MouseDown); label.MouseDoubleClick += new MouseEventHandler(lab_MouseDoubleClick); private void lab_MouseDoubleClick(object sender, MouseEventArgs e) { this.Text += " double click"; } private void lab_MouseDown(object s , MouseEventArgs e) { this.Text += " mouse doen"; }
is there any way i can manage these to events to work together ?
•
•
Join Date: Jul 2007
Location: Philippines
Posts: 255
Reputation:
Rep Power: 0
Solved Threads: 28
I don't know if this is correct but try this out hope it would help...
this.label1.MouseDown += new MouseEventHandler(this.label1_MouseDown);
this.label1.MouseDown += new MouseEventHandler(this.label1_DoubleClick);
private void label1_DoubleClick(object sender, MouseEventArgs e)
{
this.label1.Text += " double_click";
}
private void label1_MouseDown(object sender, MouseEventArgs e)
{
this.label1.Text += " mouse_Down";
}A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
•
•
Join Date: Jul 2008
Posts: 55
Reputation:
Rep Power: 1
Solved Threads: 6
hi, i tested this coding. just try this
and how many times u r pressing mousedown that many times label1_mousedown wil show and in label1 property just change Autosize=false;
if u have any problem stil let me know
if its working fine dont forget to mark problem solved
c# Syntax (Toggle Plain Text)
String str=String.Empty; private void label1_MouseDoubleClick(object sender, MouseEventArgs e) { str += "label1_MouseDoubleClick"; label1.Text = str; } private void label1_MouseDown(object sender, MouseEventArgs e) { str +="label1_MouseDown"; label1.Text = str; }
and how many times u r pressing mousedown that many times label1_mousedown wil show and in label1 property just change Autosize=false;
if u have any problem stil let me know
if its working fine dont forget to mark problem solved
Last edited by Tekmaven : Oct 2nd, 2008 at 12:14 pm. Reason: Code tags
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode