UserControl event handling
-
Hi All, I have been making a user control. (VS 2003) I wish to handle its mouse events.. something like, the control background should turn red on MouseDown, and become white again on MouseUp. I added the MouseDown and MouseUp event handlers and tried changing its BackColor on MouseDown and MouseUp events. After building and adding this control to another application, i found that the color does not change. Do i have to create my own events for this. I am not able to understand why this is not working. Can anyone help me out with this. I am new to C#. Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
-
Hi All, I have been making a user control. (VS 2003) I wish to handle its mouse events.. something like, the control background should turn red on MouseDown, and become white again on MouseUp. I added the MouseDown and MouseUp event handlers and tried changing its BackColor on MouseDown and MouseUp events. After building and adding this control to another application, i found that the color does not change. Do i have to create my own events for this. I am not able to understand why this is not working. Can anyone help me out with this. I am new to C#. Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
Did you call
this.Invalidate();
after you changed the BackColor of your control?Dave Kreskowiak Microsoft MVP - Visual Basic
-
Hi All, I have been making a user control. (VS 2003) I wish to handle its mouse events.. something like, the control background should turn red on MouseDown, and become white again on MouseUp. I added the MouseDown and MouseUp event handlers and tried changing its BackColor on MouseDown and MouseUp events. After building and adding this control to another application, i found that the color does not change. Do i have to create my own events for this. I am not able to understand why this is not working. Can anyone help me out with this. I am new to C#. Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
Hello 1- Make a break point in your code to see if the events are really excuted or not. You could also do something else like showing a MessageBox, or sending a trace, or anything as an evidence of the excution of the handlers. 2- Please post the code that you change the background with. This also might help.
Regards:rose: