nguyentaiuyenchi
Technical User
- I built a custom control for command button like XP style.
- I want to change the image when mouse hover on it.
- The code is below:
---------------------------------------------
...
private enum MouseState
{defaultState,disableState,hoverState,normalState,pressedState}
private void ChangeImage(MouseState eState)
{
imgLeft.Image=imgListLeft.Images[(int)eState];
imgRight.Image=imgListRight.Images[(int)eState];
background.BackgroundImage=imgListBckg.Images[(int)eState];
}
private void XPButton_MouseHover(object sender, System.EventArgs e)
{
ChangeImage(MouseState.hoverState);
this.Refresh();
}
private void XPButton_Load(object sender, System.EventArgs e)
{
ChangeImage(MouseState.normalState);
}
...
-------------------------------------------
- However it seem does not work for hover event (only correct for Load event). Please tell me the way to do that.
Thank so much
Uyen Chi
Software developer
- I want to change the image when mouse hover on it.
- The code is below:
---------------------------------------------
...
private enum MouseState
{defaultState,disableState,hoverState,normalState,pressedState}
private void ChangeImage(MouseState eState)
{
imgLeft.Image=imgListLeft.Images[(int)eState];
imgRight.Image=imgListRight.Images[(int)eState];
background.BackgroundImage=imgListBckg.Images[(int)eState];
}
private void XPButton_MouseHover(object sender, System.EventArgs e)
{
ChangeImage(MouseState.hoverState);
this.Refresh();
}
private void XPButton_Load(object sender, System.EventArgs e)
{
ChangeImage(MouseState.normalState);
}
...
-------------------------------------------
- However it seem does not work for hover event (only correct for Load event). Please tell me the way to do that.
Thank so much
Uyen Chi
Software developer