I want to be able to move with the mouse a form without border and title bar in c#.
I looked over youtube but i can't find anything that is working.
Someone can help me?
I want to be able to move with the mouse a form without border and title bar in c#.
I looked over youtube but i can't find anything that is working.
Someone can help me?
You can use the form's MouseDown, Up and Move events with a conditional variable like that:
private bool IsMoving;
private Point LastCursorPosition;
private void FormTest_MouseDown(object sender, MouseEventArgs e)
{
  IsMoving = true;
  LastCursorPosition = Cursor.Position;
}
private void FormTest_MouseUp(object sender, MouseEventArgs e)
{
  IsMoving = false;
}
private void FormTest_MouseMove(object sender, MouseEventArgs e)
{
  if ( IsMoving )
  {
    int x = Left - ( LastCursorPosition.X - Cursor.Position.X );
    int y = Top - ( LastCursorPosition.Y - Cursor.Position.Y );
    Location = new Point(x, y);
    LastCursorPosition = Cursor.Position;
  }
}
It works with the background of the form but you can add this to any other control too.