展开全部
这种一般要隐藏标题栏然后自己写窗体拖动的代码
bool isdown;
Point formpoint;
Point mousepoint;
private void panel_top_MouseDown(object sender, MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
if (e.Button == MouseButtons.Left)
{
isdown = true;
formpoint = this.Location;
mousepoint = Control.MousePosition;
}
}
}
private void panel_top_MouseUp(object sender, MouseEventArgs e)
{
isdown = false;
}
private void panel_top_MouseMove(object sender, MouseEventArgs e)
{
int newx = 0;
int newy = 0;
if (isdown && this.WindowState == FormWindowState.Normal)
{
Point temp = Control.MousePosition;
newx = mousepoint.X - temp.X;
newy = mousepoint.Y - temp.Y;
this.Location = new Point(formpoint.X - newx, formpoint.Y - newy);
}
}
这是窗体拖动的代码
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询