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의 자식 컨트롤입니다.

반환

Int32

control의 행 위치이거나, control의 위치가 LayoutEngine에 의해 결정되는 경우 -1입니다.

예외

control이(가) null인 경우

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 패널이 자식 컨트롤에 추가하는 속성에 의해 호출됩니다.

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

적용 대상

추가 정보