DataGridViewRow.AdjustRowHeaderBorderStyle 方法

定义

根据指定的条件修改输入行标头的边框样式。

public:
 virtual System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ AdjustRowHeaderBorderStyle(System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStyleInput, System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedRow, bool isLastVisibleRow);
public virtual System.Windows.Forms.DataGridViewAdvancedBorderStyle AdjustRowHeaderBorderStyle (System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedRow, bool isLastVisibleRow);
abstract member AdjustRowHeaderBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
override this.AdjustRowHeaderBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
Public Overridable Function AdjustRowHeaderBorderStyle (dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, dataGridViewAdvancedBorderStylePlaceholder As DataGridViewAdvancedBorderStyle, singleVerticalBorderAdded As Boolean, singleHorizontalBorderAdded As Boolean, isFirstDisplayedRow As Boolean, isLastVisibleRow As Boolean) As DataGridViewAdvancedBorderStyle

参数

dataGridViewAdvancedBorderStyleInput
DataGridViewAdvancedBorderStyle

一个表示要修改的行标头边框样式的 DataGridViewAdvancedBorderStyle

dataGridViewAdvancedBorderStylePlaceholder
DataGridViewAdvancedBorderStyle

用于存储对行标头边框样式的中间更改的 DataGridViewAdvancedBorderStyle

singleVerticalBorderAdded
Boolean

若要向结果添加单个垂直边框,则为 true;否则为 false

singleHorizontalBorderAdded
Boolean

若要向结果添加单个水平边框,则为 true;否则为 false

isFirstDisplayedRow
Boolean

如果行是 DataGridView 中显示的第一行,则为 true;否则为 false

isLastVisibleRow
Boolean

如果行是 DataGridView(已将 Visible 属性设置为 true)中显示的最后一行,则为 true;否则为 false

返回

一个表示所使用的新边框样式的 DataGridViewAdvancedBorderStyle

示例

下面的代码示例演示如何重写 AdjustRowHeaderBorderStyle 方法来自定义行标题单元格的边框。 此代码示例是为 DataGridViewAdvancedBorderStyle 类提供的一个更大示例的一部分。

public override DataGridViewAdvancedBorderStyle AdjustRowHeaderBorderStyle(
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
    bool singleVerticalBorderAdded,
    bool singleHorizontalBorderAdded,
    bool isFirstDisplayedRow,
    bool isLastDisplayedRow)
{
    // Customize the top border of the first row header and the
    // right border of all the row headers. Use the input style for 
    // all other borders.
    dataGridViewAdvancedBorderStylePlaceHolder.Top = isFirstDisplayedRow ?
        DataGridViewAdvancedCellBorderStyle.InsetDouble :
        DataGridViewAdvancedCellBorderStyle.None;
    dataGridViewAdvancedBorderStylePlaceHolder.Right =
        DataGridViewAdvancedCellBorderStyle.OutsetDouble;

    dataGridViewAdvancedBorderStylePlaceHolder.Left =
        dataGridViewAdvancedBorderStyleInput.Left;
    dataGridViewAdvancedBorderStylePlaceHolder.Bottom =
        dataGridViewAdvancedBorderStyleInput.Bottom;

    return dataGridViewAdvancedBorderStylePlaceHolder;
}
    Public Overrides Function AdjustRowHeaderBorderStyle( _
        ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
        ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
        ByVal singleVerticalBorderAdded As Boolean, _
        ByVal singleHorizontalBorderAdded As Boolean, _
        ByVal isFirstDisplayedRow As Boolean, _
        ByVal isLastDisplayedRow As Boolean) As DataGridViewAdvancedBorderStyle

        ' Customize the top border of the first row header and the
        ' right border of all the row headers. Use the input style for 
        ' all other borders.
        If isFirstDisplayedRow Then
            dataGridViewAdvancedBorderStylePlaceHolder.Top = _
                DataGridViewAdvancedCellBorderStyle.InsetDouble
        Else
            dataGridViewAdvancedBorderStylePlaceHolder.Top = _
                DataGridViewAdvancedCellBorderStyle.None
        End If

        With dataGridViewAdvancedBorderStylePlaceHolder
            .Right = DataGridViewAdvancedCellBorderStyle.OutsetDouble
            .Left = dataGridViewAdvancedBorderStyleInput.Left
            .Bottom = dataGridViewAdvancedBorderStyleInput.Bottom
        End With

        Return dataGridViewAdvancedBorderStylePlaceHolder
    End Function
End Class

注解

控件 DataGridView 在内部调用 AdjustRowHeaderBorderStyle 方法,以确定行标题单元格的边框的外观。 控件 DataGridView 通常使用 参数的 AdvancedRowHeadersBorderStyle 属性 dataGridViewAdvancedBorderStyleInput 的值。

继承者说明

如果要自定义行标题单元格边框的外观,请重写此方法。

适用于

另请参阅