AutoScroll in WinForms

Every time I need to adjust AutoSize and/or AutoScroll in WinForms, it’s always a struggle to get things working and looking right. Hopefully this post will help me avoid this struggle the next time I have to do it.

To enable AutoScroll on a panel, AutoSize must be false. If the panel is contained within another panel, that panel’s AutoSize must also be false. If any of the panels are a TableLayoutPanel, the row containing the control that needs to AutoScroll must be set to Percent, 100. All controls within all of these panels must be set to Dock.Fill. Lastly, if adding controls dynamically to any of the panels, set them to Dock.Top.

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s