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.
if you have a solution please reply below.
|
C#
Anyone know how to make a borderless form draggable in c#? |
|
Nov 20, 2018 04:19 PM
(This post was last modified: Nov 20, 2018 04:20 PM by gigajew.)
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.
![]()
Nov 20, 2018 05:10 PM
(This post was last modified: Nov 20, 2018 05:11 PM by 0xBB.)
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)
Accepting freelancing jobs ! PM me for more info !
Be the [BRAND NAME REMOVED] king .. Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
Your question is answered on the first link when google searching:
http://lmgtfy.com/?q=drag+borderless+form+c%23
Nov 22, 2018 11:41 AM
(This post was last modified: Nov 22, 2018 11:41 AM by passwords.)
@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. (Nov 22, 2018 11:41 AM)passwords 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. (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. |
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| [C#] by Ðr1psNov 9, 2015 03:56 PM | 19 | 416 |
Nov 9, 2015 03:56 PM Last Post: Ðr1ps |
| [.NET] by WildElephantApr 21, 2015 10:48 AM | 7 | 177 |
Apr 21, 2015 10:48 AM Last Post: nuk |
| [.NET] by DigiDeveloperJan 13, 2015 10:21 AM | 4 | 101 |
Jan 13, 2015 10:21 AM Last Post: DigiDeveloper |