Form behind the Windows toolbar

2

What is happening and the following, when I configure the form in C # visual studio 2015 to maximize, the bottom of the form is behind the windows taskbar, how can I solve it?

Follow the code:

public class frmComissaoPic : Form
{
    ...
    this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
    ...
}
    
asked by anonymous 27.10.2017 / 19:02

2 answers

3

According to the author of the question, the problem only occurs if these two situations occur simultaneously:

  • The form is set to start maximized;
  • Maximize button is disabled, i.e .: this.MaximizeBox = false;

This is done through the IDE, which underneath the wipes generates the code snippets present in the question and in this answer.

I tested and was able to reproduce the behavior in .NET 4.5 with Visual Studio 2013. Forms that do not have the maximize button enabled, when maximized, are behind the taskbar.

I believe that maximizing something that can not be maximized is absurd, and forcing the user to use an application that occupies the entire screen - especially if the interface components do not need it - should not be encouraged. My suggestion is to apply a minimum size to the form if necessary, but do nothing else with regards to size.

    
27.10.2017 / 22:27
1
Just completing Renan's response, which is right about the cause of Form's behavior, you can work around this by disabling the button, or the ControlBox buttons on the Load event of the Form.

The Form can be set to start maximized, but with ControlBox and MaximizeBox enabled.

In event Load , disable whatever is required.

    
27.10.2017 / 22:38