Version

AutoSize Property (AutoSizeControlBase)

Gets/sets if the control is automatically sized.
Syntax
'Declaration
 
Public Overrides Property AutoSize As Boolean
public override bool AutoSize {get; set;}
Remarks

The AutoSize property is used to determine if the control should automatically size based on its contents. When set to true, the control will be sized based on the System.Windows.Forms.Control.PreferredSize.

Example
The following sample demonstrates using the ShapeImage functionality of the UltraButton.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc

Private Sub CreateShapeImage(ByVal button As Infragistics.Win.Misc.UltraButton)
    ' create a bitmap that will be used to provide the shape
    ' of the button.
    Dim bitmap As Bitmap = New Bitmap(100, 100)

    ' create a temporary graphics object so we can render into it
    Dim g As Graphics

    Try
        g = Graphics.FromImage(bitmap)

        ' draw the background in white. whatever color
        ' is in the lower left hand pixel will be assumed
        ' to be transparent
        g.Clear(Color.White)

        ' draw our circle in a different color
        g.DrawEllipse(Pens.Black, 0, 0, 99, 99)

        ' make sure to fill it in or the only displayed
        ' part of the button will be the outline of the
        ' circle
        g.FillEllipse(Brushes.Black, 0, 0, 99, 99)
    Finally
        g.Dispose()
    End Try

    ' set the shape
    button.ShapeImage = bitmap

    ' autosize to the shape image
    button.AutoSize = True
End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;

private void CreateShapeImage(Infragistics.Win.Misc.UltraButton button)
{
	// create a bitmap that will be used to provide the shape
	// of the button.
	Bitmap bitmap = new Bitmap(100,100);

	// create a temporary graphics object so we can render into it
	using (Graphics g = Graphics.FromImage(bitmap))
	{
		// draw the background in white. whatever color
		// is in the lower left hand pixel will be assumed
		// to be transparent
		g.Clear( Color.White );

		// draw our circle in a different color
		g.DrawEllipse( Pens.Black , 0, 0, 99, 99 );

		// make sure to fill it in or the only displayed
		// part of the button will be the outline of the
		// circle
		g.FillEllipse( Brushes.Black, 0, 0, 99, 99 );
	}

	// set the shape
	button.ShapeImage = bitmap;

	// autosize to the shape image
	button.AutoSize = true;
}
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