以下是引用水中游在2006-4-30 13:48:00的发言:
1. 在Main里面定义鼠标变量和增加函数,如:
int dx;
int dy;
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button ==MouseButtons.Left)
{ dx=e.X ;dy=e.Y;
}
}
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button ==MouseButtons.Left)
{
this.Left =this.Left +(e.X -dx);
this.Top =this.Top +(e.Y -dy);
Application.DoEvents ();/*可以节省运行资源*/
}
}
真是长知识啦..
谢谢...
msdn == 葵花宝典!!!
QQ:122768959