C#窗口程序如何移动?
想要自定义窗口的最大化最小化按钮,就自己添了个图片框来表示,将窗口的FormBordelStyle设置为了None,但是这种情况下窗口没有办法移动了,如何才能使窗口自由移动?
private void panel标题_MouseDown(object sender, MouseEventArgs e) { if (e.Button==MouseButtons.Left) { zb1.x = e.X; zb1.y = e.Y; } } private void panel标题_MouseUp(object sender, MouseEventArgs e) { if (e.Button==MouseButtons.Left) { zb2.y=e.Y; zb2.x=e.X; } } private void panel标题_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Top = this.Top + (zb2.y - zb1.y); this.Left = this.Left + (zb2.x - zb1.x); } }