Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 30th, 2007, 2:15 PM   #1
Robocop
Programmer
 
Join Date: Sep 2004
Posts: 50
Rep Power: 5 Robocop is on a distinguished road
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]
Robocop is offline   Reply With Quote
Old Jun 30th, 2007, 2:50 PM   #2
Samuaijack
Programmer
 
Samuaijack's Avatar
 
Join Date: Jul 2006
Location: using Earth.Africa.Egypt.Cairo;
Posts: 76
Rep Power: 3 Samuaijack is on a distinguished road
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;

        }
Samuaijack is offline   Reply With Quote
Old Jun 30th, 2007, 5:59 PM   #3
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
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
Dameon is offline   Reply With Quote
Old Jul 1st, 2007, 7:29 AM   #4
Random-Spirit
Unverified User
 
Join Date: Jul 2007
Location: England
Posts: 22
Rep Power: 0 Random-Spirit is an unknown quantity at this point
>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.
Random-Spirit is offline   Reply With Quote
Old Jul 1st, 2007, 5:32 PM   #5
Robocop
Programmer
 
Join Date: Sep 2004
Posts: 50
Rep Power: 5 Robocop is on a distinguished road
Thumbs up

Thanks, very helpful guys
Robocop is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC