Adapt WindowsForms form to screen, C #

0

First of all NO I'm talking about making the form WindowsForms to mode responsive . My main form is designed with a resolution of 1340 x 760 with these properties established in the following way:

  • FormBorderStyle = FixedSingle.

  • StartPosition = CenterScreen.

  • WindowState = Maximized.

The laptop has a resolution of 1366 x 768 .

Although the form is positioned showing the Barra de tareas , the form does not change size according to the screen resolution and the bottom of my form is hidden or cut .

  

My form contains two panels, one side and one that completes the size of the form. I created this function to adapt the form to the work area of the screen:

public void adaptarFormulario(Form formulario)
{
     formulario.Location = Screen.PrimaryScreen.WorkingArea.Location;
     formulario.Size = Screen.PrimaryScreen.WorkingArea.Size;
}

In FormLoad :

adaptarFormulario(this); 

The Form is displayed as follows:

  

To show you the part you are hiding, I moved the Barra de Tareas to the Right Side of the screen.

Not shown full, this Cutting / Hiding this:

How can I solve this problem?

Environment: Visual Studio 2010 C #, & .NET NetFramework 4.

    
asked by J. Rodríguez 23.02.2018 в 14:39
source

1 answer

0

Resize in the load, Load, with the width that you have (that of your window) and high the one that you of the team.

<!-- language: c# -->
private void Form1_Load(object sender, EventArgs e)
{
   this.Location = new Point(0, 0); //sobra si tienes la posición en el diseño
   this.Size = new Size(this.Width, Screen.PrimaryScreen.WorkingArea.Size.Height);
}
    
answered by 25.02.2018 в 12:30