0

I'm trying to run my first Win Form C # program on a notebook, but the bottom of my program is below the taskbar. All of my controls are inside a TableLayout Panel with "Percentage" as the size type. How can I solve this?

Obs: I would like to run the windows in WindowState.Normal, without having to maximize the window, if possible. Thanks!

One of the parts of the program that is below taskbar

  • 1
    `var screen = Screen.FromControl(this); this.Bounds = screen.WorkingArea;` -- Read the notes here: [Using SetWindowPos with multiple monitors](https://stackoverflow.com/a/53026765/7444103) – Jimi Apr 26 '21 at 16:08
  • It looks like the total height of all the controls in this form is bigger than the screen height you need to use a vertical scroll bar, try to set YourTableLayout.AutoScroll to true. – Jonathan Applebaum Apr 26 '21 at 16:26
  • @Jimi Thanks, I'm gonna try this code and read the notes. – Pedro Henrique Apr 26 '21 at 16:33
  • @jonathana Have some way to adjust the height of the controls automatically according to the monitor, so that I don't have to use the vertical scrollbar? – Pedro Henrique Apr 26 '21 at 16:36
  • @PedroHenrique, In fact, I do not like to use the scroll bar in WinForms and have encountered a lot in such cases, what I would do is check what the screen height including in a `Resize()` event and if the screen height is found below a certain height then arrange the form differently maybe with a lateral layout and increase the width of the form. – Jonathan Applebaum Apr 26 '21 at 16:42
  • @jonathana Perfect, I understood completely. What I find strange in my case is that this notebook already runs another program that has practically the same controls ( [link](https://uploaddeimagens.com.br/images/003/215/036/original/WhatsApp_Image_2021-04-27_at_13.09.59.jpeg?1619539859) ) as mine, but his is even smaller and everything fit perfectly. – Pedro Henrique Apr 27 '21 at 16:12

0 Answers0