TableLayoutPanel.GetRow(Control) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 자식 컨트롤의 행 위치를 반환합니다.
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.
예외
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 자식 컨트롤에 추가하는 속성에 의해 호출됩니다.
위치가 결정control된 경우에도 실제 위치를 LayoutEngine얻으려면 메서드를 호출합니다GetPositionFromControl.