tags

dragmove

[Windows Forms] Automatically drag and drop controls (DragMove)

Here’s a piece of code I wrote a while ago, I just thought it could be useful for WinForms developers… In WPF, there is a very handy method to move a window with no borders : Window.DragMove. It can be used like that : private void Window_MouseDown(object sender, MouseButtonEventArgs e) { this.DragMove(); } When you call this method, the window is moved with the mouse until the button is released. It could hardly be simpler ;)