1个回答
2013-08-06
展开全部
int a=0, b=0,aa,bb;
bool ch = false;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
a = e.X;
b = e.Y;
ch = true;//可移动
}
//窗体移动事件
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
aa = e.X;
bb = e.Y;
ch = false;//不可移动
}
//鼠标移动事件
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (ch)
{
this.Location=new Point (this.Location.X+(e.X-a),this.Location.Y+(e.Y-b));
}
}
bool ch = false;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
a = e.X;
b = e.Y;
ch = true;//可移动
}
//窗体移动事件
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
aa = e.X;
bb = e.Y;
ch = false;//不可移动
}
//鼠标移动事件
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (ch)
{
this.Location=new Point (this.Location.X+(e.X-a),this.Location.Y+(e.Y-b));
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询