

Now the form should look like this (if the buttons are still small and not appearing in full, try to expand your form a little bit). Now back to the Data Entry Table Panel, Click Edit Rows and Columns, choose the "Rows" item in the drop down list, set the first 3 rows to " AutoSize", and set the 4 th row to " Percent", giving it 100%, this means that the last row will take all of the remaining space. Also set the Anchor for both Buttons to "Right". Set the Anchor property for this panel to Right only. In the second column, add another button and caption it as "Cancel". In the first column, add a button and caption it as "Save". For this panel, remove the last row, so that it has only two columns. Now, in the 4 th row, last column, add another table panel, name it " tblPnlButtons". This will tell the columns to take 50 % of the remaining space each. For Column 2 and Column 4, set the size type to " Percent", and set the value to 50% for each column. For Column 1 and Column 3, set the size type to " Autosize", this will force the columns to take the width of the largest child control. Now, click on the small arrow on the right side of the Data Entry table panel, and choose "Edit Rows and Columns". You will end up with an ugly form like the below: This will allow the text boxes to fill the whole width of their parent containers. Set the Anchor to all of them to be "Left and Right". Now, in the 2 nd and 4 th column of the data entry panel, add 6 text boxes. Don't worry about the design now, we will fix that shortly.

Set their text properties as: " First Name, Last Name", " Mobile Phone", " Home Phone", " Billing Addresses" and " Country". Set the Anchor of all of them to be just "Left".
Windows grid design manual#
That's why we are putting a table panel to be able to add controls as much as we want.Īdd 6 labels to the first and third column of the data entry manual form. Please note that in one cell of the table panel, we can only put one control. Set the Anchor of this panel to take all of the four sides, then expand the panel to fill all of its parent container. In this panel, we will be placing our labels, text boxes, save and cancel buttons.Īdd two additional columns and two additional rows to this new panel. After that, in the first row, add another TableLayoutPanel and name it " tblPnlDataEntry". Now remove the last column by clicking the button "Remove Last Column". name the control " tblPnlMain".Īdd a new Row to the table panel by clicking the small arrow at the right side of the panel, and then choosing "Add Row". Expand the main form, and add a new TableLayoutPanel control by dragging it from the Toolbox menu under the "Containers" section.Įxpand the new control till it fills the form, and Modify the Anchor property to attach to the 4 sides: "Top, Right, Bottom, Left".
Windows grid design windows#
A small refresh button must exist below the Grid, it must always be aligned to the right of the form.įirst let us create a new Windows Forms Applications Project.The Grid View must fill all of the remaining space.The size of the text boxes must remain equal for all text boxes, and they must fill the largest space available.Whatever the size of the form (down to a certain extent), even when the form is maximized, the following should always remain true: In this sample, we are required to build a simple manual entry form like the below, with some conditions: TableLayoutPanel is a control that "Represents a panel that dynamically lays out its contents in a grid composed of rows and columns" (From MSDN: TableLayoutPanel Class). I know that there are so many other techniques, others might use docking properties and anchors for example, but I also intended for this tip to be a discussion forum, where I can also learn about other techniques. Here is a small demonstration of the technique I use to design Windows Forms, by using a control called TableLayoutPanel. When they need to change anything in the design, or when they add a new control, it becomes a little bit messy. Over the years, I have seen many developers designing Windows Forms by just dragging and dropping controls, and then repositioning them to match their requirements.
Windows grid design download#
Download sample, updated with auto resize panel - 53.7 KB.
