Drag the mouse in WPF form

Add code in the event Window_Loaded

Add an event subscription in the form's MouseDown event window when the left mouse button pressed, call the form's DragMove () method implementation form drag

this.MouseDown += (x, y) =>
{
       if (y.LeftButton == MouseButtonState.Pressed)
       {
              this.DragMove();
       }
};

 

Guess you like

Origin www.cnblogs.com/applebox/p/11611690.html