.NET hide header but keep border

I was wondering how to hide the title of the form, but keep the original border, for example, Dropbox: screenshot

Thanks in advance!

+5
source share
1 answer

Set FormBorderStyle to FormBorderStyle.Sizable or FormBorderStyle.SizableToolWindow and set Text to an empty string and ControlBox to false

Note that FixedToolWindow will not work, it will remove the border. If you do not want this to be significant, use SizableToolWindow and add this to the codebehind form (adding both languages, as you will not specify and have not marked the question with both):

In vb.net:

 Protected Overrides Sub WndProc(ByRef message As Message) If message.Msg = &H84 Then ' WM_NCHITTEST message.Result = CType(1, IntPtr) Return End If MyBase.WndProc(message) End Sub 

In C #:

 protected override void WndProc(ref Message message) { if (message.Msg == 0x0084) // WM_NCHITTEST message.Result = (IntPtr)1; else base.WndProc(ref message); } 
+6
source

Source: https://habr.com/ru/post/1241932/


All Articles