| title | ms.custom | ms.date | ms.prod | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How to: Create a Resizable Windows Form for Data Entry |
03/30/2017 |
.net-framework |
|
article |
|
|
babdf198-404c-485d-a914-ed370c6ecd99 |
10 |
dotnet-bot |
dotnetcontent |
wpickett |
How to: Create a Resizable Windows Form for Data Entry
A good layout responds well to changes in the dimensions of its parent form. You can use the xref:System.Windows.Forms.TableLayoutPanel control to arrange the layout of your form to resize and position your controls in a consistent way as the form's dimensions change. The xref:System.Windows.Forms.TableLayoutPanel control is also useful when changes in the contents of your controls cause changes in the layout. The process covered in this procedure can be done within the Visual Studio environment. Also see Walkthrough: Creating a Resizable Windows Form for Data Entry.
Example
The following example demonstrates how to use a xref:System.Windows.Forms.TableLayoutPanel control to build a layout that responds well when the user resizes the form. It also demonstrates a layout that responds well to localization.
[!code-cppSystem.Windows.Forms.TableLayoutPanel.DataEntryForm#1] [!code-csharpSystem.Windows.Forms.TableLayoutPanel.DataEntryForm#1] [!code-vbSystem.Windows.Forms.TableLayoutPanel.DataEntryForm#1]
Compiling the Code
This example requires:
- References to the System, System.Data, System.Drawing and System.Windows.Forms assemblies.
For information about building this example from the command line for [!INCLUDEvbprvb] or [!INCLUDEcsprcs], see Building from the Command Line or Command-line Building With csc.exe. You can also build this example in [!INCLUDEvsprvs] by pasting the code into a new project. Also see How to: Compile and Run a Complete Windows Forms Code Example Using Visual Studio.
See Also
xref:System.Windows.Forms.FlowLayoutPanel
xref:System.Windows.Forms.TableLayoutPanel
How to: Anchor and Dock Child Controls in a TableLayoutPanel Control
How to: Design a Windows Forms Layout that Responds Well to Localization
Microsoft Windows User Experience, Official Guidelines for User Interface Developers and Designers. Redmond, WA: Microsoft Press, 1999. (USBN: 0-7356-0566-1)