AutoLayout by Examples - Part 3 - Dialog 1

Dialog 1: Resizable dialog containing auto-sized label and list

 

Project Name: SingleListGrowShrink.csproj. Download source.

 

Characteristics:

  • Dialog width and height resizable
  • Multi-line text label which grows and shrinks in height

 

Screen Shots:

 

 

 

Designer Layout:

 

Document Outline:

 

Key Notes:

  • Notice how the label automatically decreases its height (from 3 down to 2 lines of text) when the dialog width is increased. The listview absorbs extra vertical space or gives away vertical space as the label height shortens and grows.
  • The OK and Cancel buttons are in their own TableLayoutPanel with two columns at 50% each. Both buttons are auto-sized and anchored left/right which forces the buttons to have the same width.
  • Making buttons and labels auto-sized (AutoSize is True) is essential for localization since non-Latin locales will have different text, font, and scaling.

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included

script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm