1

How do I connect the size of any button in the form to the size of the window so that it would change proportionally to the size of the window?

I went through these:

  1. How to: Anchor Controls on Windows Forms
  2. AutoSize Property Overview

All the buttons I had on the window I applied proper anchoring and set auto size to true, but as I increase the size of the window, the size of the buttons doesn't increase with them.

4

1 回答 1

2

You'll want to set the Anchor property to match what you're trying to accomplish. If you want the width to update, set it to 'Left,Right'; for height, set it to 'Top,Bottom'.

The AutoSize property just tells the control to resize to fit it's own content, so that's not really applicable to what you're trying to do. Setting the AutoSize property to true overrides/cancels out the resizing that would happen with the correct anchoring.

于 2012-05-15T09:03:55.330 回答