Reputation: 1
I am working on a C# project and i have removed the form border so therefor users cannot drag the program around. I need them to be able to drag by a menu strip or some other toolbox item instead of the form border.
Here is the top of my project:
Upvotes: -1
Views: 104
Reputation: 1
anywhere click inside form drag....
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
Location = new Point(this.Left - (mousePoint.X - e.X), this.Top - (mousePoint.Y - e.Y));
}
}
Point mousePoint = new Point(0, 0);
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
mousePoint = new Point(e.X, e.Y);
}
Upvotes: 0