Web

폼 FormBorder 속성을 None으로 두고 폼 위치 마우스로 이동시키기

shunman 2008. 8. 4. 04:38

public Point ptRect = new Point(0, 0);

private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{

      ptRect.X = e.X;
      ptRect.Y = e.Y;

}

 private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{

      if(e.Button == MouseButtons.Left)
      {

          Point pt = new Point(this.Location.X + e.X - ptRect.X,
          this.Location.Y + e.Y - ptRect.Y);
          this.Location = pt;
      }

}

출처:데브피아
http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=17&MAEULNo=8&no=19223&ref=19223