Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show or hide a title bar on demand

I want to add an option to my windows form application (written in vb.net) that will give the user the option to hide the menu bar and the title bar. I can do the menu but i'm not sure what the best way is to hide the title.

I could just change the FormBorderStyle to none, but is that the best way of doing it?

Cheers Luke

like image 362
beakersoft Avatar asked Sep 08 '09 14:09

beakersoft


People also ask

How do you hide the title bar?

By default, title bars are shown on the windows in the page. To hide the title bar, right-click any empty space on the menu bar.

How do I show the title bar in windows?

From the Window menu, select Title Bar, then select Normal, Small, or Hidden.

How do I hide the top bar in windows?

You can hide the taskbar both in desktop mode and tablet mode. Press and hold or right-click any empty space on the taskbar, select Taskbar settings, select Taskbar behaviors, and select Automatically hide the taskbar.

How hide title bar form in VB net?

Actually you can hide the title bar during runtime (i found a way to do this), by hiding the form before you change the borderstyle to 0(/none) and then show it back again. I used a checkbox to toggle it from 0 to 1/2/3/4/5. AND it works even if it has a value in TEXT property.


2 Answers

I just found an easier solution that is working great for me during runtime. This question was posted a long time ago, but maybe somebody else will find this helpful.

The eureka for me was learning to set the form's ControlBox property to false. Note too that the text property must be empty.

    Dim f As New Form
    f.Text = String.Empty
    f.ControlBox = False
    f.Show(Me)
like image 180
Contraptor Avatar answered Oct 06 '22 01:10

Contraptor


From this page, to do it at writing time:

form1.borderstyle = 0 (None), 1 (Fixed Single), 2 (Sizeable), 3 (Fixed Dialog), 4 (Fixed Toolwindow), 5 (Sizeable Toolwindow)

However, to turn on/off at runtime is much harder, see the reasoning and the example of how to do so Here

like image 24
DVK Avatar answered Oct 06 '22 01:10

DVK