Home | Contact Us

CSharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript

<< Back to C-SHARP

TableLayoutPanel: Windows Forms

Use the TableLayoutPanel control to position controls in a grid format.
TableLayoutPanel positions controls. We require an attractive and functional GUI that resizes properly when users change the size of the window.
First, to make a TableLayoutPanel, expand the toolbox on the left side. Double click on the TableLayoutPanel icon in the left, and then open the Properties pane on the right.
Four-pane panel. You should see a four-pane panel. You will need to modify the number of columns and rows. And then you can change row spans and column spans.
Properties. Anchor is used to align, expand, or fill a control. Column is used to specify number of columns. Row specifies number of rows—add one to get a new row on the bottom.
Anchor. When you click on the space next to Anchor in the Property pane on the right, you will see a box that looks like a +. Click on the rectangles to anchor to that edge.
TextBox. To create a multi-line TextBox that fills the entire cell, set the TextBox as multiline. Add Top and Bottom in the Anchor menu by clicking on the up and down parts of the +.TextBox
Solving layout problems. TableLayoutPanel may solve many of the control alignment problems you have. TableLayoutPanel is flexible and can greatly enhance interfaces.
However, it requires a planning step before dragging controls to your form. TableLayoutPanel is easier to maintain. This planning step is worth taking.
A rigid layout makes life hard for you, as the designer, and the user who is trying to use the program in a slightly different configuration. TableLayoutPanel eliminates these problems.
The Dev Codes