DataGridViewCell.AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) DataGridViewCell.AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) DataGridViewCell.AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) DataGridViewCell.AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) Method

定義

根據指定的準則,修改輸入儲存格框線樣式。Modifies the input cell border style according to the specified criteria.

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

參數

dataGridViewAdvancedBorderStyleInput
DataGridViewAdvancedBorderStyle DataGridViewAdvancedBorderStyle DataGridViewAdvancedBorderStyle DataGridViewAdvancedBorderStyle

DataGridViewAdvancedBorderStyle,表示要修改的儲存格框線樣式。A DataGridViewAdvancedBorderStyle that represents the cell border style to modify.

dataGridViewAdvancedBorderStylePlaceholder
DataGridViewAdvancedBorderStyle DataGridViewAdvancedBorderStyle DataGridViewAdvancedBorderStyle DataGridViewAdvancedBorderStyle

DataGridViewAdvancedBorderStyle,用來儲存對儲存格框線樣式所做的中繼變更。A DataGridViewAdvancedBorderStyle that is used to store intermediate changes to the cell border style.

singleVerticalBorderAdded
Boolean Boolean Boolean Boolean

true 表示將垂直框線加入儲存格中;否則為 falsetrue to add a vertical border to the cell; otherwise, false.

singleHorizontalBorderAdded
Boolean Boolean Boolean Boolean

true 表示將水平框線加入儲存格中;否則為 falsetrue to add a horizontal border to the cell; otherwise, false.

isFirstDisplayedColumn
Boolean Boolean Boolean Boolean

如果裝載儲存格是在第一個可見的資料行中,則為 true;否則為 falsetrue if the hosting cell is in the first visible column; otherwise, false.

isFirstDisplayedRow
Boolean Boolean Boolean Boolean

如果裝載儲存格是在第一個可見的資料列中,則為 true;否則為 falsetrue if the hosting cell is in the first visible row; otherwise, false.

傳回

範例

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

public override DataGridViewAdvancedBorderStyle AdjustCellBorderStyle(
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
    bool singleVerticalBorderAdded,
    bool singleHorizontalBorderAdded,
    bool firstVisibleColumn,
    bool firstVisibleRow)
{
    // Customize the top border of cells in the first row and the 
    // right border of cells in the first column. Use the input style 
    // for all other borders.
    dataGridViewAdvancedBorderStylePlaceHolder.Left = firstVisibleColumn ?
        DataGridViewAdvancedCellBorderStyle.OutsetDouble :
        DataGridViewAdvancedCellBorderStyle.None;
    dataGridViewAdvancedBorderStylePlaceHolder.Top = firstVisibleRow ?
        DataGridViewAdvancedCellBorderStyle.InsetDouble :
        DataGridViewAdvancedCellBorderStyle.None;

    dataGridViewAdvancedBorderStylePlaceHolder.Right =
        dataGridViewAdvancedBorderStyleInput.Right;
    dataGridViewAdvancedBorderStylePlaceHolder.Bottom =
        dataGridViewAdvancedBorderStyleInput.Bottom;

    return dataGridViewAdvancedBorderStylePlaceHolder;
}
    Public Overrides Function AdjustCellBorderStyle( _
        ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
        ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
        ByVal singleVerticalBorderAdded As Boolean, _
        ByVal singleHorizontalBorderAdded As Boolean, _
        ByVal firstVisibleColumn As Boolean, _
        ByVal firstVisibleRow As Boolean) As DataGridViewAdvancedBorderStyle

        ' Customize the top border of cells in the first row and the 
        ' right border of cells in the first column. Use the input style 
        ' for all other borders.
        If firstVisibleColumn Then
            dataGridViewAdvancedBorderStylePlaceHolder.Left = _
                DataGridViewAdvancedCellBorderStyle.OutsetDouble
        Else
            dataGridViewAdvancedBorderStylePlaceHolder.Left = _
                DataGridViewAdvancedCellBorderStyle.None
        End If

        If firstVisibleRow Then
            dataGridViewAdvancedBorderStylePlaceHolder.Top = _
                DataGridViewAdvancedCellBorderStyle.InsetDouble
        Else
            dataGridViewAdvancedBorderStylePlaceHolder.Top = _
                DataGridViewAdvancedCellBorderStyle.None
        End If

        With dataGridViewAdvancedBorderStylePlaceHolder
            .Right = dataGridViewAdvancedBorderStyleInput.Right
            .Bottom = dataGridViewAdvancedBorderStyleInput.Bottom
        End With

        Return dataGridViewAdvancedBorderStylePlaceHolder
    End Function
End Class

備註

控制項會在內部AdjustCellBorderStyle呼叫方法,以判斷資料格框線的外觀。 DataGridViewThe DataGridView control internally calls the AdjustCellBorderStyle method to determine the appearance of the cell borders. 控制項通常會使用dataGridViewAdvancedBorderStyleInput參數的AdvancedCellBorderStyle屬性值。 DataGridViewThe DataGridView control typically uses the value of the AdvancedCellBorderStyle property for the dataGridViewAdvancedBorderStyleInput parameter.

DataGridViewAdvancedCellBorderStyle.OutsetPartial值不支援做為儲存格的輸入樣式。The DataGridViewAdvancedCellBorderStyle.OutsetPartial value is not supported as an input style for cells.

給繼承者的注意事項

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

適用於

另請參閱