다음을 통해 공유


How to: Size a Windows Forms Label Control to Fit Its Contents

The Windows Forms Label control can be single-line or multi-line, and it can be either fixed in size or can automatically resize itself to accommodate its caption. The AutoSize property helps you size the controls to fit larger or smaller captions, which is particularly useful if the caption will change at run time.

To make a label control resize dynamically to fit its contents

  • Set its AutoSize property to true.

If AutoSize is set to false, the words specified in the Text property will wrap to the next line if possible, but the control will not grow.

See Also

Tasks

How to: Create Access Keys with Windows Forms Label Controls

Reference

Label Control Overview (Windows Forms)

Other Resources

Label Control (Windows Forms)