Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How can I maintain equal sizing amongst horizontally-aligned autosizing buttons?

Here is the scenario:

Simply setting Button.AutoSize=true would cause the buttons to have unequal size, ala:

Instead,

  1. place the controls within a TableLayoutPanel
  2. One row and three columns for this example

  1. Set each column to equal percentage column style
  2. Anchor all buttons Left, Right (stretch)
  3. Set TableLayoutPanel AutoSize to true

The buttons now will resize correctly.