C# winform remove title bar but keep borders
- User
C# winform remove title bar but keep borders
- Assistant
To remove the title bar and keep the borders in a C# WinForms application, you can modify the Form's properties and handle the form's events.
First, set the
FormBorderStyleproperty to specify the type of border, such as Sizable, Fixed3D, FixedSingle, etc. Then, set theControlBoxproperty tofalseto hide the standard title bar buttons (minimize, maximize, close).In addition, override the
WndProcmethod and handle theWM_NCHITTESTmessage to allow the user to move the form by clicking and dragging its border.Here's an example:
csharp