When I put the window to FormBorderStyle = None
and maximize it, it pops up, hiding the taskbar.
I'd like to know how to make it maximized, but not hide the taskbar.
When I put the window to FormBorderStyle = None
and maximize it, it pops up, hiding the taskbar.
I'd like to know how to make it maximized, but not hide the taskbar.
With the property FormBorderStyle
set to None
, you will have to handle this manually. That is, if you use WindowState = FormWindowState.Maximized
, the taskbar will be behind the form .
My tip is you manually set the size of the form, disregarding the size of the taskbar (which is, by default, 40px since Windows 7). Obviously, the size and location of the taskbar can be changed by user settings - there is the option to use "small icons" which decreases the size of the bar and also the option to place it at either end of the monitor (up, down, right , left). Not to mention that the taskbar can be hidden automatically.
The code below maximizes the form based on the screen width and height (minus 40px from the standard taskbar).
Obviously it is possible to get information about the task bar, such as location and size, but it would be necessary to call some Windows API. Depending on your idea, this is a lot of work for a not very good result, maybe that would fit into a more specific question.
Private Sub BtMaximizar_Click(sender As Object, e As EventArgs) Handles Button2.Click
Width = Screen.PrimaryScreen.Bounds.Width //Largura igual a largura da tela
Height = Screen.PrimaryScreen.Bounds.Height - 40 // Altura da tela, menos a barra
Location = New Point() //New Point() cria um point com x = 0 e y = 0
StartPosition = FormStartPosition.Manual
End Sub