![]() |
|
[C#] Anyone know how to make a borderless form draggable in c#? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] Anyone know how to make a borderless form draggable in c#? (/showthread.php?tid=5910088) |
Anyone know how to make a borderless form draggable in c#? - KingSea - Nov 20, 2018 I've looked all over the internet for solutions, but didn't find any because they are in visual basic not c#. if you have a solution please reply below. RE: Anyone know how to make a borderless form draggable in c#? - gigajew - Nov 20, 2018 It's fairly straightforward. In your regular windows form, just override WndProc() and put your drag-drop logic there. In the following example I created my own property called TitleBarHeight, which defines how high on the form the cursor has to be to allow movement. Note that I also initialize this property in the Form's constructor. RE: Anyone know how to make a borderless form draggable in c#? - 0xBB - Nov 20, 2018 Use wpf: Code <Window x:Class="GayNamespace.MainWindow"and the Window_MouseDown in your viewmodel event is: Code private void Window_MouseDown(object sender, MouseButtonEventArgs e)RE: Anyone know how to make a borderless form draggable in c#? - HFDone - Nov 21, 2018 https://hackforums.net/showthread.php?tid=4558018 RE: Anyone know how to make a borderless form draggable in c#? - Nick (Name) - Nov 21, 2018 Your question is answered on the first link when google searching: http://lmgtfy.com/?q=drag+borderless+form+c%23 RE: Anyone know how to make a borderless form draggable in c#? - passwords - Nov 22, 2018 @ibennz beat me to it. Use WPF, no one uses Winforms anymore and if you do you're either a skid or a retard where as one compliments the other pretty nice. EDIT Or if you work with legacy stuff at work. may god bless their souls. Create a WPF project, set the Windows WindowStyle property to None and add a event for MouseDown and then add a some logic to see wether the LeftMouse button is pressed and if it is just call the DragMove(); function. RE: Anyone know how to make a borderless form draggable in c#? - Nick (Name) - Nov 22, 2018 (Nov 22, 2018 11:41 AM)NETGuard Wrote: @ibennz beat me to it. I still use WinForms for some, big emphasis on some, projects. Usually only ever use WinForms for simple UI applications. I do enjoy WPF a lot more than WinForms for theming. RE: Anyone know how to make a borderless form draggable in c#? - passwords - Nov 22, 2018 (Nov 22, 2018 11:52 AM)Nick (Name) Wrote: I still use WinForms for some, big emphasis on some, projects. Usually only ever use WinForms for simple UI applications. I do enjoy WPF a lot more than WinForms for theming. Not only for theming but think about MVVM, databinging etc. Just makes it so much easier to maintain, I do get that some people still use Winforms though, I personally think they should scrap it, they obviously can't due to the massive amount of companies running on legacy. |