TableLayoutPanel.GetRow(Control) 메서드

정의

지정된 자식 컨트롤의 행 위치를 반환합니다.

public:
 int GetRow(System::Windows::Forms::Control ^ control);
public int GetRow(System.Windows.Forms.Control control);
member this.GetRow : System.Windows.Forms.Control -> int
Public Function GetRow (control As Control) As Integer

매개 변수

control
Control

의 자식 컨트롤입니다 TableLayoutPanel.

반품

control행 위치 또는 위치가 결정되는 control경우 LayoutEngine -1.

예외

controlnull입니다.

control 은 이 LayoutEngine형식으로 정렬할 수 있는 형식이 아닙니다.

예제

다음 코드 예제에서는 모든 자식 컨트롤을 TableLayoutPanel 열거 하 고 메서드를 사용 하 여 GetRow 각 행 인덱스를 찾습니다.

private void getRowBtn_Click(
    System.Object sender, 
    System.EventArgs e)
{
    foreach ( Control c in this.TableLayoutPanel1.Controls )
    {
        Trace.WriteLine(this.TableLayoutPanel1.GetRow(c));
    }
}
Private Sub getRowBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles getRowBtn.Click

    Dim c As Control
    For Each c In Me.TableLayoutPanel1.Controls

        Trace.WriteLine(Me.TableLayoutPanel1.GetRow(c))

    Next

End Sub

설명

둘 이상의 행에 걸쳐 있는 경우 control 메서드는 GetRow 가장 낮은 행 인덱스를 반환합니다.

행 위치 값은 0부터 시작하는 값이므로 반환된 GetRowHeights배열의 인덱스로 사용할 수 있습니다.

이 메서드는 디자인 타임에 패널이 Row 자식 컨트롤에 추가하는 속성에 의해 호출됩니다.

위치가 결정control된 경우에도 실제 위치를 LayoutEngine얻으려면 메서드를 호출합니다GetPositionFromControl.

적용 대상

추가 정보