TableLayoutPanel.GetColumn(Control) 메서드

정의

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

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

매개 변수

control
Control

의 자식 컨트롤입니다 TableLayoutPanel.

반품

지정한 자식 컨트롤의 열 위치이거나 위치가 .에 의해 control결정되면 LayoutEngine -1.

예외

controlnull입니다.

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

예제

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

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

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

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

    Next

End Sub

설명

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

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

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

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

적용 대상

추가 정보