Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Collapse]Layout Manager
    [Expand]Product Information
    [Expand]Getting Started
    [Expand]Layout Control
    [Expand]Data Layout Control
    [Expand]Layout Item
    [Expand]Layout Groups
    [Expand]Tabbed Group
    [Expand]Other Layout Elements
    [Expand]Customization Capabilities
    [Collapse]Size and Alignment
      Size Constraints
      Default Size Constraints
      Custom Size Constraints
      Layout Item's Size Constraints vs. Client Area's Size Constraints
      Locking the Size of Layout Items (animation)
      Aligning Controls Within Layout Items
      Layout Support For Third Party Controls
     Flow Layout
     Table Layout
     Focus Management
    [Expand]Appearance and Look and Feel
    [Expand]Miscellaneous
    [Expand]Examples
    [Expand]Member Tables
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Custom Size Constraints

By default, a layout item's size is limited by the default size constraints, which are dependant upon the type of control displayed within the layout item. This topic describes how to override the default size constraints by imposing custom size limitations. To learn about the default size constraints, refer to the Default Size Constraints topic.

Expanded Custom Size Constraints

To provide custom size constraints for a layout item and its client area, set the LayoutControlItem.SizeConstraintsType property to SizeConstraintsType.Custom. Custom size constraints can be set for a layout item via the LayoutControlItem.MinSize and LayoutControlItem.MaxSize properties, or for the layout item's client area via the LayoutControlItem.ControlMinSize and LayoutControlItem.ControlMaxSize properties.

The LayoutControlItem.MinSize and LayoutControlItem.ControlMinSize properties and the LayoutControlItem.MaxSize and LayoutControlItem.ControlMaxSize properties are synchronized. See Layout Item's Size Constraints vs. Client Area's Size Constraints to learn more.

If the Width or Height field of the MaxSize or ControlMaxSize properties is set to 0, the width/height of this layout item is not limited.

In default size constraints mode, the control always fills the layout item's client area in its entirety. In custom size constraints mode, the control also fills the client area by default. However, in this mode it's possible to make the control occupy only a portion of the client area and custom align the control within the layout item (for instance, center the control horizontally or vertically). To make the control not fill the client area entirely, apply size constraints to the control via the System.Windows.Forms.Control.MaximumSize and System.Windows.Forms.Control.MinimumSize properties. If the control's size is less then the client area, it can be custom aligned within the client area via the LayoutControlItem.ControlAlignment property. See Aligning Controls Within Layout Items for more information.

Expanded Customizing Size Constraints via the Menu

The Layout Control's Context Menu contains specific commands that affect the size constraints of layout items:

Selecting a specific command from the Size Constraints group does the following:

Command Description
 Reset to default Applies the default size constraints to the item, as described in the Default Size Constraints topic.

This command sets the layout item's LayoutControlItem.SizeConstraintsType to Default.

Free sizing Unlocks the upper limits of the item's width and height that are specified by the MaxSize properties.

This command sets the layout item's LayoutControlItem.SizeConstraintsType to Custom. The MaxSize.Width and MaxSize.Height properties are set to 0. The MinSize property is set to the default minimum (the same value as in the Default size constraints mode).

Lock Size Locks the layout item's current size, so the layout item can no longer be resized.

This command sets the LayoutControlItem.SizeConstraintsType to Custom. The MaxSize and MinSize properties are set to the value specified by the layout item's BaseLayoutItem.Size property.

Lock Width Locks the layout item's current width.

This command sets the LayoutControlItem.SizeConstraintsType to Custom. The MaxSize.Width and MinSize.Width properties are set to the value specified by the layout item's Size.Width property. The MaxSize.Height and MinSize.Height properties remain unchanged.

Lock Height Locks the layout item's current height.

This command sets the LayoutControlItem.SizeConstraintsType to Custom. The MaxSize.Height and MinSize.Height properties are set to the current height specified by the layout item's Size.Height property. The MaxSize.Width and MinSize.Width properties remain unchanged.

Expanded See Also

How would you rate this topic?​​​​​​​