DataGridViewRow.AdjustRowHeaderBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) 方法

定義

根據指定的準則,修改輸入資料列行首框線樣式。Modifies an input row header border style according to the specified criteria.

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,表示要修改的資料列行首框線樣式。A DataGridViewAdvancedBorderStyle that represents the row header border style to modify.

dataGridViewAdvancedBorderStylePlaceholder
DataGridViewAdvancedBorderStyle

DataGridViewAdvancedBorderStyle,用來儲存對資料列行首框線樣式所做的中繼變更。A DataGridViewAdvancedBorderStyle that is used to store intermediate changes to the row header border style.

singleVerticalBorderAdded
Boolean

true 表示要在所產生的結果上加入單垂直框線,否則為 falsetrue to add a single vertical border to the result; otherwise, false.

singleHorizontalBorderAdded
Boolean

true 表示要在所產生的結果上加入單水平框線,否則為 falsetrue to add a single horizontal border to the result; otherwise, false.

isFirstDisplayedRow
Boolean

如果資料列是 DataGridView 中所顯示的第一個資料列,則為 true,否則為 falsetrue if the row is the first row displayed in the DataGridView; otherwise, false.

isLastVisibleRow
Boolean

如果目前的資料列是將 DataGridView 屬性設定為 trueVisible 中的最後一個資料列,則為 true,否則為 falsetrue if the row is the last row in the DataGridView that has its Visible property set to true; otherwise, false.

傳回

DataGridViewAdvancedBorderStyle,表示所使用的新框線樣式。A DataGridViewAdvancedBorderStyle that represents the new border style used.

範例

下列程式碼範例示範如何覆寫 AdjustRowHeaderBorderStyle 方法,以自訂資料列行首儲存格的框線。The following code example demonstrates how to override the AdjustRowHeaderBorderStyle method to customize the borders of the row header cells. 這個程式碼範例是針對 DataGridViewAdvancedBorderStyle 類別所提供的較大範例的一部分。This code example is part of a larger example provided for the DataGridViewAdvancedBorderStyle class.

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 方法,以判斷資料列行首儲存格的框線外觀。The DataGridView control internally calls the AdjustRowHeaderBorderStyle method to determine the appearance of the borders for the row header cells. DataGridView 控制項通常會針對 dataGridViewAdvancedBorderStyleInput 參數使用 AdvancedRowHeadersBorderStyle 屬性的值。The DataGridView control typically uses the value of the AdvancedRowHeadersBorderStyle property for the dataGridViewAdvancedBorderStyleInput parameter.

給繼承者的注意事項

如果您想要自訂資料列行首儲存格的框線外觀,請覆寫這個方法。Override this method if you want to customize the appearance of the borders of row header cells.

適用於

另請參閱