1.在一个无标题的窗体中用MOUSEMOVE事件判断鼠标坐标是否到达窗体的边缘,如果是的话将鼠标指针改为可调整窗体大小的双向箭头.
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(0 == e.X)
{
this.Cursor = Cursors.SizeWE;
}
//改成这样就可以了,很奇怪(不能写成:e.X >= this.Width)
else if(e.X >= this.Width-2)
{
this.Cursor = Cursors.SizeWE;
}
else
{
this.Cursor = Cursors.Default;
}
}