代码
public partial class Form1 : Form
{
private Point oldPoint = new Point(0,0);
public Form1()
{
InitializeComponent();
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this.Close();
}

private void linkLabel2_MouseDown(object sender, MouseEventArgs e)
{
oldPoint.X
= Cursor.Position.X;
oldPoint.Y
= Cursor.Position.Y;
}

private void linkLabel2_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
int offset_x = Cursor.Position.X-oldPoint.X;
int offset_y = Cursor.Position.Y -oldPoint.Y;
this.Location = new Point(this.Location.X + offset_x, this.Location.Y + offset_y);
oldPoint.X
= Cursor.Position.X;
oldPoint.Y
= Cursor.Position.Y;
}
}
}

 

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-10-08
  • 2022-01-01
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2021-11-10
相关资源
相似解决方案