Winform hell-running programs with low resolution

I’ve a problem, we developed a winform program that has a really big startup form. The height of the form is 880 pixel and is designed to work on big monitors. Clearly everything is resizable, so if you resize the form you can still work with it, with no problem.


Figure 1: the form resized

as you can see the form is divided in: blue part (filters), yellow part (result of the query), and finally red part (detail of selected element). As you can see, even when the form is resized it is still usable. A user that work at 1027×768 send me this screenshot telling me that she could not edit details of the items


Figure 2: layout is completely messed, the red part (edit details) is missing

She told me that she is not able to edit records, because the bottom part is missing, so I wonder why this is happening.

The form has a single TabControl, that contains a lot of other controls. It seems that if the form is opened at a resolution that was greater than screen resolution the tabItem will keep the original height, and since it is anchored to up,left,bottom,top, it got messed. Since the Tabcontrol has a height in the designer of 802 pixel, the form gets resizied to 730 but the TabControl still is 802 pixel, and the whole layout got messed up.

The solution is this simple fix.

if (this.Height > Screen.PrimaryScreen.WorkingArea.Height)
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
tabControl1.Height = this.Height - 78;

This is not elegant code, but since the height of the TabControl is 78 pixel less than the heigh of the full form, I simply put a check to verify if the height of the form is greater than the height of the screen. If true I automatically resize both the form and the TabControl accordingly and the problem is solved.