DataGridViewColumn.DividerWidth DataGridViewColumn.DividerWidth DataGridViewColumn.DividerWidth DataGridViewColumn.DividerWidth Property

定义

获取或设置列分隔符的宽度(以像素为单位)。Gets or sets the width, in pixels, of the column divider.

public:
 property int DividerWidth { int get(); void set(int value); };
public int DividerWidth { get; set; }
member this.DividerWidth : int with get, set
Public Property DividerWidth As Integer

属性值

分隔符(该列的右边距)的宽度(以像素为单位)。The thickness, in pixels, of the divider (the column's right margin).

示例

下面的代码示例在第三列后添加一个垂直边缘。The following code example adds a vertical edge after the third column. 此代码示例是为DataGridViewColumn类提供的更大示例的一部分。This code example is part of a larger example provided for the DataGridViewColumn class.

// Set the vertical edge.
void Button7_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   int thirdColumn = 2;
   
   //        int edgeThickness = 5;
   DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ];
   column->DividerWidth = 10;
}


// Set the vertical edge.
private void Button7_Click(object sender,
    System.EventArgs e)
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    column.DividerWidth = 10;
}
' Set the vertical edge.
Private Sub Button7_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button7.Click

    Dim thirdColumn As Integer = 2
    Dim column As DataGridViewColumn = _
        dataGridView.Columns(thirdColumn)
    column.DividerWidth = 10

End Sub

注解

此属性可用于在冻结的列与可以滚动的列之间提供可视边界。This property is useful to provide a visual boundary between frozen columns and columns that can scroll. 额外边缘是当前列的一部分,尽管它将采用关联DataGridView的的前景色。The extra edge is part of the current column, although it will take on the foreground color of the associated DataGridView. 额外边缘并不扩展用户可以双击以自动调整列大小的区域。The extra edge does not extend the area in which users can double-click to automatically resize a column. 若要调整列的大小,用户必须双击分隔符与相邻列之间的边界。To resize a column, the user must double-click on the boundary between the divider and the adjacent column.

适用于

另请参阅