(C#)Winform 关于隐藏标题栏后的问题
1.用图片重绘窗体。
2。鼠标点击窗体时记录鼠标在窗口的坐标,点击之后的移动则根据记录的坐标和鼠标移动的坐标更新窗口的坐标。
代码太多就不全贴出来了。
1.
代码略
2.
实现移动
private Point mousePosition;
private void XX_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mousePosition.X = e.X;
mousePosition.Y = e.Y;
}
}
private void XX_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Top = Control.MousePosition.Y - mousePosition.Y
- SystemInformation.FrameBorderSize.Height + 8;
this.Left = Control.MousePosition.X - mousePosition.X
- SystemInformation.FrameBorderSize.Width + 8;
}
}