TableLayoutPanel.GetColumn(Control) Method
Definition
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.
Returns the column position of the specified child 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
Parameters
- control
- Control
A child control of the TableLayoutPanel.
Returns
The column position of the specified child control, or -1 if the position of control
is determined by LayoutEngine.
Exceptions
control
is null
.
control
is not a type that can be arranged by this LayoutEngine.
Examples
The following code example enumerates all the child controls in the TableLayoutPanel and finds the column index for each control using the GetColumn method.
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
Remarks
If control
spans two or more columns, the GetColumn method will return the lowest column index.
The column position value is zero based, so you can use it as an index for the array returned by GetColumnWidths.
This method is called by the Column
property, which the panel adds to its child controls at design time.
To get the actual position of control
, even when its position is determined by LayoutEngine, call the GetPositionFromControl method.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기