visual studio Button Problems?
Question: visual studio Button Problems?
( Back )
Answer #1:
Add a MouseMove event handler to the control (probably a Panel or GroupBox) that holds the button (not the button itself, because the button won't see MouseMove events until the mouse is actually over the button.)
That handler can look at the x,y coordinates. I'd like to give you a code sample, but my .NET experience is with C#. But, since .NET is (mostly) language-agnostic, the idea should still work. Your handler will get a MouseEventArgs object as a parameter, and that object has proerties named X and Y that hold the mouse coordinates, with (0,0) being the top left pixel of the control that fired the event.
You'll have to do the test to see when that (X,Y) location is close enough to the button. If button1 is the button, for example, use button1.Location.X and button1.Location.Y to display or set the button location, and button1.Size.Width, button1.Size.Height can also be handy in figuring out how close the mouse is to the nearest part of the button.
You can find a description of the event, plus some Visual Basic sample code, at the MSDN web site:
Click Here
** Powered by Yahoo Answers