DataGridView.AdjustColumnHeaderBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean) 方法

定义

为当前正在绘制的 DataGridView 的列标题单元格调整 DataGridViewAdvancedBorderStyleAdjusts the DataGridViewAdvancedBorderStyle for a column header cell of a DataGridView that is currently being painted.

public:
 virtual System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ AdjustColumnHeaderBorderStyle(System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStyleInput, System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStylePlaceholder, bool isFirstDisplayedColumn, bool isLastVisibleColumn);
public virtual System.Windows.Forms.DataGridViewAdvancedBorderStyle AdjustColumnHeaderBorderStyle (System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool isFirstDisplayedColumn, bool isLastVisibleColumn);
abstract member AdjustColumnHeaderBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
override this.AdjustColumnHeaderBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
Public Overridable Function AdjustColumnHeaderBorderStyle (dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, dataGridViewAdvancedBorderStylePlaceholder As DataGridViewAdvancedBorderStyle, isFirstDisplayedColumn As Boolean, isLastVisibleColumn As Boolean) As DataGridViewAdvancedBorderStyle

参数

dataGridViewAdvancedBorderStyleInput
DataGridViewAdvancedBorderStyle

一个 DataGridViewAdvancedBorderStyle,它表示要修改的列标题边框样式。A DataGridViewAdvancedBorderStyle that represents the column header border style to modify.

dataGridViewAdvancedBorderStylePlaceholder
DataGridViewAdvancedBorderStyle

一个 DataGridViewAdvancedBorderStyle,用于存储对列标题边框样式进行的中间更改。A DataGridViewAdvancedBorderStyle that is used to store intermediate changes to the column header border style.

isFirstDisplayedColumn
Boolean

如果要指示当前正在绘制的 DataGridViewCell 位于 DataGridView 上显示的第一列中,则为 true;否则为 falsetrue to indicate that the DataGridViewCell that is currently being painted is in the first column displayed on the DataGridView; otherwise, false.

isLastVisibleColumn
Boolean

如果要指示当前正在绘制的 DataGridViewCell 位于 Visible 属性设置为 trueDataGridView 中的最后一列,则为 true;否则为 falsetrue to indicate that the DataGridViewCell that is currently being painted is in the last column in the DataGridView that has the Visible property set to true; otherwise, false.

返回

一个 DataGridViewAdvancedBorderStyle,表示当前列标题的边框样式。A DataGridViewAdvancedBorderStyle that represents the border style for the current column header.

示例

下面的代码示例演示如何重写 AdjustColumnHeaderBorderStyle 方法以自定义列标题单元格的边框。The following code example demonstrates how to override the AdjustColumnHeaderBorderStyle method to customize the borders of the column header cells. 此代码示例是为 DataGridViewAdvancedBorderStyle 类提供的更大示例的一部分。This code example is part of a larger example provided for the DataGridViewAdvancedBorderStyle class.

public override DataGridViewAdvancedBorderStyle AdjustColumnHeaderBorderStyle(
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
    bool firstDisplayedColumn,
    bool lastVisibleColumn)
{
    // Customize the left border of the first column header and the
    // bottom border of all the column headers. Use the input style for 
    // all other borders.
    dataGridViewAdvancedBorderStylePlaceHolder.Left = firstDisplayedColumn ?
        DataGridViewAdvancedCellBorderStyle.OutsetDouble :
        DataGridViewAdvancedCellBorderStyle.None;
    dataGridViewAdvancedBorderStylePlaceHolder.Bottom =
        DataGridViewAdvancedCellBorderStyle.Single;

    dataGridViewAdvancedBorderStylePlaceHolder.Right =
        dataGridViewAdvancedBorderStyleInput.Right;
    dataGridViewAdvancedBorderStylePlaceHolder.Top =
        dataGridViewAdvancedBorderStyleInput.Top;

    return dataGridViewAdvancedBorderStylePlaceHolder;
}
    Public Overrides Function AdjustColumnHeaderBorderStyle( _
        ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
        ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
        ByVal firstDisplayedColumn As Boolean, ByVal lastVisibleColumn As Boolean) _
        As DataGridViewAdvancedBorderStyle

        ' Customize the left border of the first column header and the
        ' bottom border of all the column headers. Use the input style for 
        ' all other borders.
        If firstDisplayedColumn Then
            dataGridViewAdvancedBorderStylePlaceHolder.Left = _
                DataGridViewAdvancedCellBorderStyle.OutsetDouble
        Else
            dataGridViewAdvancedBorderStylePlaceHolder.Left = _
                DataGridViewAdvancedCellBorderStyle.None
        End If

        With dataGridViewAdvancedBorderStylePlaceHolder
            .Bottom = DataGridViewAdvancedCellBorderStyle.Single
            .Right = dataGridViewAdvancedBorderStyleInput.Right
            .Top = dataGridViewAdvancedBorderStyleInput.Top
        End With

        Return dataGridViewAdvancedBorderStylePlaceHolder
    End Function
End Class

注解

@No__t-0 控件在内部调用 AdjustColumnHeaderBorderStyle 方法来确定列标题单元格的边框外观。The DataGridView control internally calls the AdjustColumnHeaderBorderStyle method to determine the appearance of the borders for the column header cells. @No__t-0 控件通常使用 dataGridViewAdvancedBorderStyleInput 参数的 @no__t 属性的值。The DataGridView control typically uses the value of the AdvancedColumnHeadersBorderStyle property for the dataGridViewAdvancedBorderStyleInput parameter.

继承者说明

如果要自定义列标题单元格的边框外观,请重写此方法。Override this method if you want to customize the appearance of the border on column header cells.

适用于

另请参阅