Search code examples
c#winformsautosize

How to avoid Winform auto resize resulting in controls cropped?


I created a Form with fixed size, containing a fixed sized TableLayoutPanel. Controls are anchored to the TableLayoutPanel using the Anchor property. However controls are cropped after moving from Desktop to laptop.

I have tried setting MinimumSize, AutoSize and AutoSacling in Form and TableLayoutPanel, but controls are still cropped.

Suggestions?


Solution

  • You should try using Dock property of TableLayoutPanel.

    Change its value to fill (Dock = Fill), this way your TableLayoutPanel will be drawn within the form border.

    Another suggestion is, you should divide your main tablelayouttable like a grid and put one control inside its individual cell. Set their Dock property to Fill and you will see the result.

    Hope it helps. Good Luck.