Move the form????

  • Thread starter Thread starter simsimlhr
  • Start date Start date
S

simsimlhr

We can move the form While mouse is pressed over title bar.If title
bar is hide.Then how can we move the form while button is pressed
over the client area.
Any function
Thanx in advance.
Qasim Raza
 
Have a boolean (mousePressed in the example) toggle when mouse up or mouse down events occur so you can tell when then mouse button is pressed over the client area
private void Form1_MouseDown(object sender, MouseEventArgs e

mousePressed = true

private void Form1_MouseUp(object sender, MouseEventArgs e

mousePressed = false

Then use the mouse move event and do something roughly like this

private void Form1_MouseMove(object sender, MouseEventArgs e

if(mousePressed

this.Location = new Point(e.X, e.Y

}
 
Back
Top