public partial class Form1 : Form
{
Point LeftDown;
public Form()
{
InitializeComponent();
LeftDown = new Point();
}
private void panel_MouseDown(object sender, MouseEventArgs e)
{
LeftDown.X = e.X;
LeftDown.Y = e.Y;
}
private void panel_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point p = MousePosition;
p.Offset(-LeftDown.X, -LeftDown.Y);
Location = p;
}
}
}
winform 自定义标题头拖动
最新推荐文章于 2024-08-25 21:53:27 发布