Windows Develop Bookmark and Share   
 index > Windows Forms General > how to make a rollover button
 

how to make a rollover button

was wondering how to use two different button images to create a rolover effect so that when the mouse is moved over the button then it changes the look of the button.

also how do you add sound to a button when the mouse moves over and off of it.

also just wondering can you use html to make a rollover in C# ?

Zombie_002  Wednesday, January 03, 2007 5:52 PM

Hi

check out this link :
http://www.windowsforms.net/ControlGallery/ControlDetail.aspx?Control=230&tabindex=5

or roll your own :)

public class RolloverButton : Button {

private Color _NormalColor;

public RolloverButton()

: base() {

}

protected override void OnMouseEnter(EventArgs e) {

base.OnMouseEnter(e);

_NormalColor = this.BackColor;

this.BackColor = Color.Red;

}

protected override void OnMouseLeave(EventArgs e) {

base.OnMouseLeave(e);

this.BackColor = _NormalColor;

}

}

Hope this helps you out :)

frederikm  Wednesday, January 03, 2007 6:05 PM

You can use google to search for other answers

Custom Search

More Threads

• Properties.Settings.Default.Upgrade() not working
• Objects and Forms
• Limit code access to certain assemblies
• Call parent form function from child form??
• How to improve the performance of populating a combo box with a large datasource?
• Delegate not calling function defined under Windows forms ?
• Chage Image Shapes
• Image cannot be added to the ImageList
• is there anyway to close all opened windows(not MDI)
• I can´t resize my controls into a inherit form