Delete title bar in Windows Forms

How to remove the blue border that is on top of the window shape? (I definitely don't know his name.)

+48
c # winforms
Sep 20 '11 at 9:24 a.m.
source share
6 answers

You can set the FormBorderStyle property to none in the constructor, or in the code:

 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 
+100
Sep 20 2018-11-11T00:
source share

If you mean the title for Blue Border thats on top of the Window Form , set the ControlBox Forms property to false and Text to an empty string ("").

here's a snippet:

 this.ControlBox = false; this.Text = String.Empty; 
+54
Sep 20 '11 at 9:50 a.m.
source share

enter image description here

+23
Sep 21 2018-11-11T00:
source share

Also add this bit of code to your form so that it can still be dragged.

Just add it right before the constructor (a method that calls InitializeComponent ()




 private const int WM_NCHITTEST = 0x84; private const int HTCLIENT = 0x1; private const int HTCAPTION = 0x2; /// /// Handling the window messages /// protected override void WndProc(ref Message message) { base.WndProc(ref message); if (message.Msg == WM_NCHITTEST && (int)message.Result == HTCLIENT) message.Result = (IntPtr)HTCAPTION; } 



This code: https://jachman.wordpress.com/2006/06/08/enhanced-drag-and-move-winforms-without-having-a-titlebar/

Now, to get rid of the title bar, but still have a border, combine the code with another answer:

this.ControlBox = false;

this.Text = String.Empty;

with this line:

this.FormBorderStyle = FormBorderStyle.FixedSingle;




Put these 3 lines of code on the OnLoad form, and you should have a nice floating form that can be dragged using a thin border (use FormBorderStyle.None if you don't want a border).

+14
Feb 08 '15 at 4:29
source share

Set FormsBorderStyle form to None .

If you do this, then you decide how to implement the drag and drop function of the window.

+10
Sep 20 2018-11-11T00:
source share
  Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None 
+8
Jan 25 '15 at 17:53
source share



All Articles