Tips and Tricks: Making Windows Forms Size to Their Content
Windows In WPF can make use of a property which makes the window to automatically adjust its own size to fit its content. The related property in WPF is
SizeToContent which can be set to
Manual (the default),
WidthAndHeight. The last item makes the window shrink or grow so that it will fit its content.
The same effect can be made in Windows Forms using the
AutoSizeMode properties of the form. Simply set
true and also do not forget to set
GrowAndShrink. This effect is not visualized during design.