Admin Admin
Posts : 404 Join date : 15/06/2011 Age : 42 Location : Caloocan Philippines
| Subject: form movement formborderstyle=none Thu Sep 15, 2011 4:26 pm | |
| - Code:
-
public AUTHENTICATION() { InitializeComponent(); this.MouseUp += this.Form1_MouseUp; this.MouseDown += this.Form1_MouseDown; this.MouseMove += this.Form1_MouseMove; }
private bool mDragging; private Point mLastPos; private void Form1_MouseDown(object sender, MouseEventArgs e) { mDragging = true; mLastPos = this.PointToScreen(e.Location); } private void Form1_MouseUp(object sender, MouseEventArgs e) { mDragging = false; } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (!mDragging) return; Point pos = this.PointToScreen(e.Location); this.Location = new Point(this.Left + pos.X - mLastPos.X, this.Top + pos.Y - mLastPos.Y); mLastPos = pos; } | |
|