There is probably no way to do this completely in managed code, you may have to make your own code for it, but I can give you an algorithm.
Suppose you know the location of the icon and the size, then the algorithm is simple.
Rectangle mouseBounds = new Rectangle(Cursor.Positon.X, Cursor.Positon.Y, Cursor.Width, Cursor.Height);
Rectangle iconBounds = new Rectangle(getIconX(), getIconY());
if (mouseBounds.Intersects(iconBounds))
{
MessageBox.Show("Is hovering over icon");
}
source
share