Blog Archives

Keep controls centered on resizable form

When dealing with resizable forms, managing layout can be achieved via the Anchor and Dock properties or using a layout panel. However, sometimes the design requires that certain controls stay centered, regardless of the parent form’s size. Luckily, a simple solution exists that does not involve writing centering code and handling resizing events. Read the rest of this entry


Uniform resizing of multiple containers in Windows Forms

When dealing with resizable dialogs, anchoring is the best way to ensure that certain controls, like containers or data grids, stretch and resize along with with the form itself. This ensures that the user experience is enhanced when dealing with large quantities of data that are, by default designed, viewed on small window. While this design is sufficient for certain cases, in other, more business like, there are limitations that can be overcome by using different container. Read the rest of this entry

Windows Forms AutoSize usage (.NET bug included)

Although development of Windows Forms stopped two .NET versions ago and was pretty much replaced by WPF, there are still legacy .NET applications around based on Windows Forms. Since mixing WPF and Forms is generally a bad idea, this small article aims to show that dynamic and flexible layouts are still possible and in fact easily achieved in Windows Forms. I will also show you that there are certain hoops that need to be jumped over like .NET bugs.
Read the rest of this entry