Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

TableLayoutPanel.RowStyles Property

Definition

Namespace:
System.Windows.Forms
Assembly:
System.Windows.Forms.dll
Source:
TableLayoutPanel.cs
Source:
TableLayoutPanel.cs
Source:
TableLayoutPanel.cs
Source:
TableLayoutPanel.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets a collection of row styles for theTableLayoutPanel.

public: property System::Windows::Forms::TableLayoutRowStyleCollection ^ RowStyles { System::Windows::Forms::TableLayoutRowStyleCollection ^ get(); };
[System.ComponentModel.Browsable(false)]public System.Windows.Forms.TableLayoutRowStyleCollection RowStyles { get; }
[<System.ComponentModel.Browsable(false)>]member this.RowStyles : System.Windows.Forms.TableLayoutRowStyleCollection
Public ReadOnly Property RowStyles As TableLayoutRowStyleCollection

Property Value

ATableLayoutRowStyleCollection containing aRowStyle for each row in theTableLayoutPanel control.

Attributes

Examples

The following code example sets theRowStyle properties of each row when aButton is clicked.

private void toggleRowStylesBtn_Click(    System.Object sender,     System.EventArgs e){    TableLayoutRowStyleCollection styles =         this.TableLayoutPanel1.RowStyles;    foreach( RowStyle style in styles )    {        if (style.SizeType==SizeType.Absolute)        {            style.SizeType = SizeType.AutoSize;        }        else if(style.SizeType==SizeType.AutoSize)        {            style.SizeType = SizeType.Percent;            // Set the row height to be a percentage            // of the TableLayoutPanel control's height.            style.Height = 33;        }        else        {            // Set the row height to 50 pixels.            style.SizeType = SizeType.Absolute;            style.Height = 50;        }    }}
Private Sub toggleRowStylesBtn_Click( _ByVal sender As System.Object, _ByVal e As System.EventArgs) _Handles toggleRowStylesBtn.Click    Dim styles As TableLayoutRowStyleCollection = _    Me.TableLayoutPanel1.RowStyles    For Each style As RowStyle In styles        If style.SizeType = SizeType.Absolute Then            style.SizeType = SizeType.AutoSize        ElseIf style.SizeType = SizeType.AutoSize Then            style.SizeType = SizeType.Percent            ' Set the row height to be a percentage            ' of the TableLayoutPanel control's height.            style.Height = 33        Else            ' Set the row height to 50 pixels.            style.SizeType = SizeType.Absolute            style.Height = 50        End If    NextEnd Sub

Remarks

Use theRowStyles property to access the style properties of specific rows. You can use members of theRowStyle class to set the characteristics of individual rows in the table.

When theTableLayoutPanel control arranges its rows, it assigns priorities to eachRowStyle in the following order:

  1. Rows withRowStyle set toAbsolute are considered first, and their fixed heights are allocated.

  2. Rows withRowStyle set toAutoSize are sized to their contents.

  3. Remaining space is divided among rows withRowStyle set toPercent.

Applies to

See also

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?