Thursday, July 30, 2009

C# help please?

In C# Visual Studio 2005 how do I make it so that when the mouse is no longer in the group box area something happens? Here is my code so far:





private void groupBox1_MouseHover(object sender, EventArgs e)


{


btnTopIncrease.Visible = true;





}





How do I modify this code so that this happens when the mouse is out of the area?








Thanks,


Sophie

C# help please?
I don't know C# very well (only the bare basics) but you should look for one of the following:





1. Put the group boxes in a "block", I don't know the exact term but it's the line that goes around a grouping of controls. You can set a hover on that, so when the hover is on that, do what you want to happen when it's out of the grouping of radio buttons.


2. Not sure if this'll work or not, but the same as #1, but instead of using another control under the radio buttons, try with the form itself and set a private variable for the status. So...something like statusShow = true, within the MouseHover function, and then on hover for the main form something like:


if(statusShow == true) {


// Do your stuff here.


}





There may other options too, I'm not sure off hand though.
Reply:The MouseHover event is triggered when the mouse is stationary over the control. There are other events like MouseEnter and MouseLeave that would be more appropriate for what you want to do. Add an event handler for MouseLeave to trigger an event when the mouse leaves the control.


No comments:

Post a Comment