Results 1 to 6 of 6

Thread: [RESOLVED] Mouse Over Buttons

  1. #1

    Thread Starter
    Fanatic Member steve65's Avatar
    Join Date
    Jun 2000
    Posts
    610

    [RESOLVED] Mouse Over Buttons

    !!! Newb Alert !!!

    I am trying to figure how the sample plugin project here is changing the color on the button in plugin number 2.

    Would someone please explain to me how this is being done.

    Thanks Steve
    Last edited by steve65; Sep 1st, 2005 at 08:43 PM.
    This space for rent...

  2. #2
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Mouse Over Buttons

    That link produces an error page for me. But you can easily change the backcolor property

    Code:
    private void button1_MousEnter(object sender, System.EventArgs e)
    {
        ((Button)sender).BackColor = Color.Red;
    }
    
    private void butto1_MouseLeave(object sender, System.EventArgs e)
    {
        ((Button)sender).BackColor = this.BackColor;
    }
    You have to manualy add the event handlers of course.

    Also: this wouldn't work with XP-styles
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Mouse Over Buttons

    The link worked just fine for me. Maybe the site was having issues when you tried.

  4. #4

    Thread Starter
    Fanatic Member steve65's Avatar
    Join Date
    Jun 2000
    Posts
    610

    Re: Mouse Over Buttons

    Quote Originally Posted by grilkip
    That link produces an error page for me. You have to manualy add the event handlers of course.

    Also: this wouldn't work with XP-styles
    That happened with me, I did a refresh on the browser and I was able to get it to load. I think their server gets overloaded.

    As far as the MouseEnter MouseLeave events I could not find anywhere in their code where these events were setup. Again I am new so I may not have looked in all of the right spots.

    I have also read about having your app use XP Styles but I did not know where that would be setup either.
    This space for rent...

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Mouse Over Buttons

    You can enable XP visual styles in your app by calling Application.EnableVisualStyles() in your Main method. If you use any ImageList components then you need to follow that with a call to Application.DoEvents() or you will have issues. You then need to set the FlatStyle property to System for all controls that support it. You can also use a manifest file, but that is a pain in the b*tt, and I gave up trying soon after I started. There are still issues with the visual style support in Visual Studio, like the fact that you cannot put images on Buttons and UpDown controls don't support visual styles at all. To overcome the vast majority of these issues, you can dowload the free VisualStyles component from www.skybound.ca. You simply add a VisualStyleProvider component to each form and call VisualStyleProvider.EnableVisualStyles() in your Main method instead and voila! No need to set the FlatStyle properties either. You can remove visual style support for individual controls if you want to. The only issues with this could be that in some shops developers cannot use third party components, and forms with a very large number of controls can run more slowly. To help in this situation you can disable VisualStyleProvider support for those controls that display correctly using the FlatStyle property.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Fanatic Member steve65's Avatar
    Join Date
    Jun 2000
    Posts
    610

    Re: Mouse Over Buttons

    Thank you very much, that was it the EnableVisualStyles was set. Thanks for the info on the skybound tools I will take a look at them.
    This space for rent...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width