DataGridViewCell.AdjustCellBorderStyle メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCell.AdjustCellBorderStyle メソッドの意味・解説 

DataGridViewCell.AdjustCellBorderStyle メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

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

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Overridable Function
 AdjustCellBorderStyle ( _
    dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle,
 _
    dataGridViewAdvancedBorderStylePlaceholder As DataGridViewAdvancedBorderStyle,
 _
    singleVerticalBorderAdded As Boolean, _
    singleHorizontalBorderAdded As Boolean,
 _
    isFirstDisplayedColumn As Boolean, _
    isFirstDisplayedRow As Boolean _
) As DataGridViewAdvancedBorderStyle
Dim instance As DataGridViewCell
Dim dataGridViewAdvancedBorderStyleInput As
 DataGridViewAdvancedBorderStyle
Dim dataGridViewAdvancedBorderStylePlaceholder As
 DataGridViewAdvancedBorderStyle
Dim singleVerticalBorderAdded As Boolean
Dim singleHorizontalBorderAdded As Boolean
Dim isFirstDisplayedColumn As Boolean
Dim isFirstDisplayedRow As Boolean
Dim returnValue As DataGridViewAdvancedBorderStyle

returnValue = instance.AdjustCellBorderStyle(dataGridViewAdvancedBorderStyleInput,
 dataGridViewAdvancedBorderStylePlaceholder, singleVerticalBorderAdded, singleHorizontalBorderAdded,
 isFirstDisplayedColumn, isFirstDisplayedRow)
public virtual DataGridViewAdvancedBorderStyle AdjustCellBorderStyle
 (
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder,
    bool singleVerticalBorderAdded,
    bool singleHorizontalBorderAdded,
    bool isFirstDisplayedColumn,
    bool isFirstDisplayedRow
)
public:
virtual DataGridViewAdvancedBorderStyle^ AdjustCellBorderStyle (
    DataGridViewAdvancedBorderStyle^ dataGridViewAdvancedBorderStyleInput, 
    DataGridViewAdvancedBorderStyle^ dataGridViewAdvancedBorderStylePlaceholder,
 
    bool singleVerticalBorderAdded, 
    bool singleHorizontalBorderAdded, 
    bool isFirstDisplayedColumn, 
    bool isFirstDisplayedRow
)
public DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, 
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, 
    boolean singleVerticalBorderAdded, 
    boolean singleHorizontalBorderAdded, 
    boolean isFirstDisplayedColumn, 
    boolean isFirstDisplayedRow
)
public function AdjustCellBorderStyle (
    dataGridViewAdvancedBorderStyleInput : DataGridViewAdvancedBorderStyle, 
    dataGridViewAdvancedBorderStylePlaceholder : DataGridViewAdvancedBorderStyle,
 
    singleVerticalBorderAdded : boolean, 
    singleHorizontalBorderAdded : boolean, 
    isFirstDisplayedColumn : boolean, 
    isFirstDisplayedRow : boolean
) : DataGridViewAdvancedBorderStyle

パラメータ

dataGridViewAdvancedBorderStyleInput

変更するセルの境界線スタイルを表す DataGridViewAdvancedBorderStyle。

dataGridViewAdvancedBorderStylePlaceholder

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

singleVerticalBorderAdded

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

singleHorizontalBorderAdded

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

isFirstDisplayedColumn

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

isFirstDisplayedRow

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

戻り値
変更後の DataGridViewAdvancedBorderStyle。

解説解説

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

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

継承時の注意 セル境界線の外観をカスタマイズする場合は、このメソッドをオーバーライドします。

使用例使用例

AdjustCellBorderStyle メソッドをオーバーライドして、セルの境界線をカスタマイズするコード例を次に示します。このコード例は、DataGridViewAdvancedBorderStyle クラスのトピックで取り上げているコード例の一部分です。

    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
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;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
DataGridView クラス
InheritedStyle
GetInheritedStyle
HasStyle
Style



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

DataGridViewCell.AdjustCellBorderStyle メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewCell.AdjustCellBorderStyle メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS