Version

AutoSizeMode Property

Gets or sets the type of auto-sizing used when AutoSize is True.
Syntax
'Declaration
 
Public Property AutoSizeMode As AutoSizeMode
public AutoSizeMode AutoSizeMode {get; set;}

Property Value

GrowOnly if the UltraPanel will only increase in size to display is contents; GrowAndShrink if the UltraPanel will also shrink when the control is larger than needed to display the contents.
Example
The following code demonstrates how to control the automatic sizing capability of the UltraPanel

Imports System.Windows.Forms
Imports Infragistics.Win


' Use a solid border style so the bounds of the UltraPanel are easily visible
Me.UltraPanel1.BorderStyle = UIElementBorderStyle.Solid

' Allow the UltraPanel to automatically size based on its contents.
Me.UltraPanel1.AutoSize = True

' Set the size of the UltraPanel
Me.UltraPanel1.Size = New Size(300, 300)

' Set the auto size mode so that the control will grow and shrink in each dimension
' so that it's right and bottom edges are just far enough to show all child controls.
Me.UltraPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink

' Add two .Net Button controls to the UltraPanel: one which forces the right edge of 
' the UltraPanel out by extending to 500 pixels in the X direction, and another which
' causes the bottom edge to only shrink slightly by extending to 200 pixels in the Y 
' direction.
Dim button1 As New Button()
button1.Location = New Point(400, 0)
button1.Size = New Size(100, 20)
Me.UltraPanel1.ClientArea.Controls.Add(button1)

Dim button2 As New Button()
button2.Location = New Point(0, 100)
button2.Size = New Size(20, 100)
Me.UltraPanel1.ClientArea.Controls.Add(button2)
using System.Windows.Forms;
using Infragistics.Win;

// Use a solid border style so the bounds of the UltraPanel are easily visible
this.ultraPanel1.BorderStyle = UIElementBorderStyle.Solid;

// Allow the UltraPanel to automatically size based on its contents.
this.ultraPanel1.AutoSize = true;

// Set the size of the UltraPanel
this.ultraPanel1.Size = new Size( 300, 300 );

// Set the auto size mode so that the control will grow and shrink in each dimension
// so that it's right and bottom edges are just far enough to show all child controls.
this.ultraPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;

// Add two .Net Button controls to the UltraPanel: one which forces the right edge of 
// the UltraPanel out by extending to 500 pixels in the X direction, and another which
// causes the bottom edge to only shrink slightly by extending to 200 pixels in the Y 
// direction.
Button button1 = new Button();
button1.Location = new Point( 400, 0 );
button1.Size = new Size( 100, 20 );
this.ultraPanel1.ClientArea.Controls.Add( button1 );

Button button2 = new Button();
button2.Location = new Point( 0, 100 );
button2.Size = new Size( 20, 100 );
this.ultraPanel1.ClientArea.Controls.Add( button2 );
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also