AutoLayout by Examples - Part 3 - Dialog 3

Dialog 3: Fixed-sized dialog containing GroupBoxes

 

Project Name: GroupboxesFixedDialog.csproj. Download source.

 

Characteristics:

  • Fixed-sized dialog containing GroupBoxes which in turn contains checkboxes and radio buttons

 

Screen Shots:

 

Designer Layout:

 

Document Outline:

 

Key Notes:

  • The height of the dialog in the designer will not be the actual run-time height. Note the big gap at the bottom in the designer. This gap will be closed at run-time since the dialog AutoSize is True.
  • TableLayoutPanel is not the answer to all layout problems. When we have choices (check boxes and radio buttons) wrapped in groupboxes like these, there isn’t much we can do to completely avoid the text from being clipped when the dialog is localized to certain locales. However, there are a couple of things we can do to help alleviate this problem:
    • Set AutoEllipsis to True. This will display a tooltip with the full text when the text is clipped.
    • Set the initially dialog width so that the text won’t be clipped in most locales
    • In the dialog OnLoad override, check all controls, calculate their preferred widths, and resize the dialog width to compensate for the widest control

 

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