Export (0) Print
Expand All
Expand Minimize

SizeType Enumeration

Specifies how rows or columns of user interface (UI) elements should be sized relative to their container.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

'Declaration
Public Enumeration SizeType
'Usage
Dim instance As SizeType

public enum SizeType
public enum SizeType

 Member nameDescription
AbsoluteThe row or column should be sized to an exact number of pixels. 
AutoSizeThe row or column should be automatically sized to share space with its peers. 
PercentThe row or column should be sized as a percentage of the parent container. 

The SizeType enumeration specifies how rows or columns of UI elements, typically controls, should be sized relative to the size of their container. This enumeration is used by the RowStyle and ColumnStyle classes to indicate their preferred sizing attributes. The TableLayoutPanel class, in turn, uses these style classes.

When laying out a container with rows or columns that have different preferred sizing attributes, any space remaining after the initial allocation will be distributed between the rows or columns whose styles have TableLayoutStyle.SizeType property values of AutoSize or Percent.

The following example shows how to set the TableLayoutStyle.SizeType property on a ColumnStyle object. This code example is part of a larger example provided for the TableLayoutPanel control.

Private Sub toggleColumnStylesBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles toggleColumnStylesBtn.Click

    Dim styles As TableLayoutColumnStyleCollection = _
    Me.TableLayoutPanel1.ColumnStyles

    For Each style As ColumnStyle In styles

        If style.SizeType = SizeType.Absolute Then

            style.SizeType = SizeType.AutoSize

        ElseIf style.SizeType = SizeType.AutoSize Then

            style.SizeType = SizeType.Percent

            ' Set the column width to be a percentage
            ' of the TableLayoutPanel control's width.
            style.Width = 33

        Else

            ' Set the column width to 50 pixels.
            style.SizeType = SizeType.Absolute
            style.Width = 50

        End If

    Next

End Sub

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft