DataGridViewCell.AdjustCellBorderStyle メソッド

定義

指定した条件に従って、入力セルの境界線スタイルを変更します。

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

dataGridViewAdvancedBorderStylePlaceholder
DataGridViewAdvancedBorderStyle

セルの境界線スタイルに対する中間的な変更を格納するために使用される DataGridViewAdvancedBorderStyle

singleVerticalBorderAdded
Boolean

垂直方向の境界線をセルに追加する場合は true。それ以外の場合は false

singleHorizontalBorderAdded
Boolean

水平方向の境界線をセルに追加する場合は true。それ以外の場合は false

isFirstDisplayedColumn
Boolean

ホストしているセルが最初に表示される列にある場合は true。それ以外の場合は false

isFirstDisplayedRow
Boolean

ホストしているセルが最初に表示される行にある場合は true。それ以外の場合は false

戻り値

DataGridViewAdvancedBorderStyle

変更された DataGridViewAdvancedBorderStyle です。

次のコード例では、メソッドをオーバーライド AdjustCellBorderStyle してセルの境界線をカスタマイズする方法を示します。 このコード例は、DataGridViewAdvancedBorderStyle クラスのために提供されている大規模な例の一部です。

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

注釈

コントロールは DataGridView 内部的にメソッドを AdjustCellBorderStyle 呼び出して、セルの境界線の外観を決定します。 通常、コントロールは DataGridView パラメーターのプロパティの AdvancedCellBorderStyle 値を dataGridViewAdvancedBorderStyleInput 使用します。

この DataGridViewAdvancedCellBorderStyle.OutsetPartial 値は、セルの入力スタイルとしてサポートされていません。

注意 (継承者)

セルの罫線の外観をカスタマイズする場合は、このメソッドをオーバーライドします。

適用対象

こちらもご覧ください