Form behind the Windows bar

Asked

Viewed 718 times

2

What is happening and the following, when I set the form in c# visual studio 2015 to maximized, the bottom of the form is behind the windows taskbar, how can I solve the problem.

Follows the code:

public class frmComissaoPic : Form
{
    ...
    this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
    ...
}
  • Could you put your code?

  • yes of course...

  • what good is that: CloseButtonDisabler.DisableCloseButton(this.Handle.ToInt32()); ?

  • This class uses to disable the X button of the form

  • try not to use this, and see if the error persists

  • @Juniorguerreiro What option are you using to make the form maximized? The form is borderless?

  • So I’m already opening the maximized form, the edge is like Fixedsingle

  • 1

    What I could notice is that if I disable the maximize button of the main form and open the maximized direct from there I have problems with the task bar, now enable the maximize of the main form and open the form without maximizing or be openit usually , maximize by the button of the form there it rethinks the taskbar.

  • 1

    The whole problem is to disable the maximize button in the main form, I just made a test here, I left the maximize button of the main form enabled and Windowstate left to open maximized, ai sim ele respeito a barra de tarefas.

  • Checks the property of the form "Ismdicontainer"

  • The code you put up has nothing to do with the problem.

  • before the question was more complete... the problem is not with the WindowState

Show 7 more comments

2 answers

3


According to the questioner himself, the problem only occurs if these two situations occur simultaneously:

  • Form is configured to start maximized;
  • The maximize button is disabled, i.e.: this.MaximizeBox = false;

This is done through the IDE, which behind the scenes 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 don’t have the maximize button enabled, when maximized, gets behind the taskbar.

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

  • Vlw for the answers. I will review here the behavior of my screens to improve as much as possible my program..

1

Just complementing the response of Renan, who is right about the cause of Form’s behavior, you can circumvent this by disabling the button, or the buttons ControlBox at the event Load form.

The Form may be set to start maximized, but with the ControlBox and MaximizeBox qualified.

At the event Load, disable what is necessary.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.