Use the Position property of the Cursor class found in the System.Windows.Forms namespace. Here is code that will flag whether the mouse is over button1.
Point ptCursor = Cursor.Position;
ptCursor = PointToClient(ptCursor);
if( button1.Bounds.Contains(ptCursor) )
{
//mouse over button1
//....
}
else
{
//mouse not over button1
//....
}
Share with