![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Sep 2004
Posts: 50
Rep Power: 5
![]() |
C# MouseEnter Event
I'm just trying to make a toolstrip button switch to another background color with MouseEnter.
What I did was double click the buton and this threw me to the code window, so I just changed the Click event to MouseEnter, and it's not working on MouseEnter. Wish somebody can give me some help on this. Thanks [PHP] private void PayrollToolStrip_MouseEnter(Object sender, EventArgs e) { PayrollToolStrip.BackColor = Color.White; }[/PHP] |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jul 2006
Location: using Earth.Africa.Egypt.Cairo;
Posts: 76
Rep Power: 3
![]() |
the 'O' of object shouldn't be capitalized(don't know if this is the write word) here is what i mean is:
private void PayrollToolStrip_MouseEnter(object sender, EventArgs e)
{
PayrollToolStrip.BackColor = Color.White;
} |
|
|
|
|
|
#3 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
Events are not done by name. The handler could just as easily be named 'foo.' The only thing that matters is that the handler is properly added to the event. When using the visual designer this is hidden from you. It creates a handler, with the name TheObject_Event just as convention, but also adds something along the lines of
TheObject.Event += new MyEventHandler(TheObject_Event) The Click handler is only the default event for most controls. To wire up an event of your choosing, you must select the control and click the Events button. Or you could change it manually in the form initialization code. Your choice.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#4 |
|
Unverified User
Join Date: Jul 2007
Location: England
Posts: 22
Rep Power: 0
![]() |
>the 'O' of object shouldn't be capitalized
Rubbish. C# has in inbuilt type called object that is a synonym for System.Object. Just like int is a synonym for System.Int32. If you say "using System;" at the top of your code (like most people do) then System.Object will be available, so it does not make a difference if you caplitablise the O or not. The compiler does not care if you use the real .net types from the System namespace or the C# keywords that are aliases for those types. In the end it generates the same IL. |
|
|
|
|
|
#5 |
|
Programmer
Join Date: Sep 2004
Posts: 50
Rep Power: 5
![]() |
Thanks, very helpful guys
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Click event triggered unexpectedly | ParadiseIsle | Visual Basic | 1 | Dec 16th, 2006 8:25 PM |
| School's Out Bash - LAN Event in Ash Flat, Arkansas | bigguy | Coder's Corner Lounge | 21 | Apr 24th, 2006 5:12 PM |
| console event handling | jayme | C++ | 3 | Jan 1st, 2006 3:40 PM |
| question: usage of delagates and custom events | melbolt | C# | 1 | Oct 3rd, 2005 8:17 PM |
| Help! I have a problem | thomas55 | C++ | 1 | Apr 24th, 2005 2:16 PM |