Working with Docking Property
The Dock Control allows you to dock the control to any of the edges of the form of its container. It's another way to make your controls intact when you resize the form. When you resize the form, the control remains docked to the edge specified. The Dock property accepts a value from the System.Windows.Forms.DockStyle enumeration. The following are the values available in this enumeration.
DockStyle | Description |
---|---|
Bottom | The control's bottom edge is docked to the bottom edge of its containing control. |
Fill | All the edges of the control are docked to all the edges of its containing control and are sized appropriately. |
Left | The control's left edge is docked to the left edge of its containing control. |
Right | The control's right edge is docked to the right edge of its containing control. |
None | The control is not docked. |
Top | The control's top edge is docked to the top edge of its containing control. |
System.Windows.Forms.DockStyle Enumeration Values
Let's try docking a button control into different edges of the form.
To dock a control, select the control to dock and go to Properties Window.
Read More:- User Controls in Visual C#.net
The center square means that you will use the DockStyle.Fill value for the Dock property. The following screenshots show the effect of docking the control to different edges.
Bottom
Top
Left
Right
Fill
If you have multiple controls and use the same docking values, then they will be placed beside or above each other.
Left
Right
Fill
If you have multiple controls and use the same docking values, then they will be placed beside or above each other.
Read More:-
- User Controls in Visual C#.net
- How To Press Keyboard Event keys using c#
- C# Mouse Events in Window Application
- How to Dynamically Adding Controls in C# window apps
- Separating Design and Functionality in C# Window Application
- Message Box C#-Trickcode
- [Lambda] Expressions In c#
- LINQ In C#.Net
- How : To Read A Text File In C#
- How to Writing a Text File In C#
- LINQ To SQL Datacontext
- LINQ Aggregate Methods | Visual c#
- Changing the Casing of Strings
- C# | Variable | A tour of the C# language
Post A Comment:
0 comments: