Use the MouseMove event:
private void button1_MouseMove(object sender, MouseEventArgs e)
{
Button b = sender as Button;
if (b != null)
{
if (((e.X <= b.Margin.Left) || (e.X >= b.Width - b.Margin.Right)) ||
((e.Y <= b.Margin.Top) || (e.Y >= b.Height - b.Margin.Bottom)))
{
Cursor = Cursors.SizeAll;
}
else
{
Cursor = Cursors.Default;
}
}
}
private void button1_MouseLeave(object sender, EventArgs e)
{
Cursor = Cursors.Default;
}
The MouseLeave event is just there to ensure the cursor is restored to normal if it is moved quickly.
This shows a button and uses the margins, but it works for all controls, and you can specify your own edge limits.