Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

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

Windows Forms FAQs

What are some Autolayout considerations for textbox button combinations?

Every scenario differs a bit, but a TableLayoutPanel can often address this issue. For instance, if you have the following arrangement:

Simple setting the button to AutoSize (assuming the button is anchored Top, Left) would "push" the form bigger (assuming the Form was AutoSize=true), ala:

What you really want is for the form to remain its current size and the button to take up space from the textbox. To accomplish this:

  1. Place both in a 2 column, 1 row TableLayoutPanel
  2. Set the Button's column to be AutoSize
  3. Set the TextBox's column to be 100%, and presto, you get:



Page view counter