Manage WinForm controls using the Anchor and Dock properties

Many beginning WinForms developers have trouble keeping the controls on their forms uniform and organized. Often the controls look fine at design time, but when the form is resized at runtime the controls either lose their positions or don’t compensate for the resized form. To alleviate this problem, the .NET Framework allows you to set properties on child controls to mandate how they will behave when the parent form is resized. The two properties that are used to mandate a control’s resize behavior are “Dock” and “Anchor”. Zach Smith explains how to use the built-in Anchor and Dock properties of a control to mandate its behavior during resizing. The download also includes Visual Studio project files with examples of the Anchor and Dock properties in action.

This download is also available as a TechRepublic article.

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Resource Details

Provided by:
Zach Smith
Topic:
Software
Format:
Other Download