DataGridViewCellStyleとは? わかりやすく解説

DataGridViewCell.Style プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

セルスタイル取得または設定します

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

Public Property Style As
 DataGridViewCellStyle
Dim instance As DataGridViewCell
Dim value As DataGridViewCellStyle

value = instance.Style

instance.Style = value
public DataGridViewCellStyle Style { get; set;
 }
public:
property DataGridViewCellStyle^ Style {
    DataGridViewCellStyle^ get ();
    void set (DataGridViewCellStyle^ value);
}
/** @property */
public DataGridViewCellStyle get_Style ()

/** @property */
public void set_Style (DataGridViewCellStyle
 value)
public function get Style
 () : DataGridViewCellStyle

public function set Style
 (value : DataGridViewCellStyle)

プロパティ
DataGridViewCellStyle。

解説解説
使用例使用例

Style プロパティ使用してセル背景色取得する方法次のコード例示します。このコード例は、DataGridViewColumn クラストピック取り上げているコード例一部分です。

Private Sub CustomizeCellsInThirdColumn()

    Dim thirdColumn As Integer
 = 2
    Dim column As DataGridViewColumn = _
        dataGridView.Columns(thirdColumn)
    Dim cell As DataGridViewCell = _
        New DataGridViewTextBoxCell()

    cell.Style.BackColor = Color.Wheat
    column.CellTemplate = cell
End Sub
private void CustomizeCellsInThirdColumn()
{
    int thirdColumn = 2;
    DataGridViewColumn column =
        dataGridView.Columns[thirdColumn];
    DataGridViewCell cell = new DataGridViewTextBoxCell();

    cell.Style.BackColor = Color.Wheat;
    column.CellTemplate = cell;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewCellStyle
DataGridView.CellStyleChanged イベント
DataGridView.DefaultCellStyle プロパティ
DataGridViewRow.DefaultCellStyle
DataGridViewColumn.DefaultCellStyle

DataGridViewCellStyle クラス

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

DataGridView コントロール内のセル適用される書式指定情報およびスタイル情報表します

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

Public Class DataGridViewCellStyle
    Implements ICloneable
Dim instance As DataGridViewCellStyle
public class DataGridViewCellStyle : ICloneable
public ref class DataGridViewCellStyle : ICloneable
public class DataGridViewCellStyle implements
 ICloneable
public class DataGridViewCellStyle implements
 ICloneable
解説解説

DataGridViewCellStyle クラス使用すると、DataGridView複数セル、行、列、列ヘッダー、および行ヘッダー間でスタイル情報共有することにより、個別セルスタイル プロパティ設定するために必要なメモリ節約できますDataGridViewCellStyle 型のプロパティを持つクラス、およびそうしたクラス間の関係の詳細については、「Windows フォーム DataGridView コントロールでのセルスタイル」を参照してください

使用例使用例

次のコード例では、複数DataGridViewCellStyle オブジェクトプロパティ設定することによる効果示します。この例では、DefaultCellStyle プロパティBackColor プロパティ設定することにより、DataGridView含まれるセル背景色設定します。ただし、AlternatingRowsDefaultCellStyle プロパティBackColor プロパティ設定されるため、背景色が 1 行おきにオーバーライドされますまた、Last Prepared という列の DefaultCellStyle プロパティFormat プロパティ設定することにより、この列の日付書式決定されます。

Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms

Public Class Form1
    Inherits System.Windows.Forms.Form

    <STAThreadAttribute()> _
    Public Shared Sub Main()
        Application.Run(New Form1())
    End Sub

    Private WithEvents dataGridView1 As
 New DataGridView()

    Protected Overrides Sub
 OnLoad(ByVal e As EventArgs)

        ' Create the columns and load the data.
        PopulateDataGridView()

        ' Configure the appearance and behavior of the DataGridView.
        InitializeDataGridView()

        ' Initialize the form.
        Me.Text = "DataGridView style demo"
        Me.Size = New Size(600, 250)
        Me.Controls.Add(dataGridView1)
        MyBase.OnLoad(e)

    End Sub

    ' Configures the appearance and behavior of a DataGridView control.
    Private Sub InitializeDataGridView()

        ' Initialize basic DataGridView properties.
        dataGridView1.Dock = DockStyle.Fill
        dataGridView1.BackgroundColor = Color.LightGray
        dataGridView1.BorderStyle = BorderStyle.Fixed3D

        ' Set property values appropriate for read-only display and
 
        ' limited interactivity. 
        dataGridView1.AllowUserToAddRows = False
        dataGridView1.AllowUserToDeleteRows = False
        dataGridView1.AllowUserToOrderColumns = True
        dataGridView1.ReadOnly = True
        dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
        dataGridView1.MultiSelect = False
        dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
        dataGridView1.AllowUserToResizeColumns = False
        dataGridView1.ColumnHeadersHeightSizeMode = _
            DataGridViewColumnHeadersHeightSizeMode.DisableResizing
        dataGridView1.AllowUserToResizeRows = False
        dataGridView1.RowHeadersWidthSizeMode = _
            DataGridViewRowHeadersWidthSizeMode.DisableResizing

        ' Set the selection background color for all the cells.
        dataGridView1.DefaultCellStyle.SelectionBackColor = Color.White
        dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Black

        ' Set RowHeadersDefaultCellStyle.SelectionBackColor so that
 its default
        ' value won't override DataGridView.DefaultCellStyle.SelectionBackColor.
        dataGridView1.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty

        ' Set the background color for all rows and for alternating
 rows. 
        ' The value for alternating rows overrides the value for all
 rows. 
        dataGridView1.RowsDefaultCellStyle.BackColor = Color.LightGray
        dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.DarkGray

        ' Set the row and column header styles.
        dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
        dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Black
        dataGridView1.RowHeadersDefaultCellStyle.BackColor = Color.Black

        ' Set the Format property on the "Last Prepared" column
 to cause
        ' the DateTime to be formatted as "Month, Year".
        dataGridView1.Columns("Last Prepared").DefaultCellStyle.Format
 = "y"

        ' Specify a larger font for the "Ratings" column.
 
        Dim font As New
 Font( _
            dataGridView1.DefaultCellStyle.Font.FontFamily, 25, FontStyle.Bold)
        Try
            dataGridView1.Columns("Rating").DefaultCellStyle.Font
 = font
        Finally
            font.Dispose()
        End Try

    End Sub

    ' Changes the foreground color of cells in the "Ratings"
 column 
    ' depending on the number of stars. 
    Private Sub dataGridView1_CellFormatting(ByVal
 sender As Object, _
        ByVal e As DataGridViewCellFormattingEventArgs)
 _
        Handles dataGridView1.CellFormatting

        If e.ColumnIndex = dataGridView1.Columns("Rating").Index
 _
            AndAlso e.Value IsNot Nothing Then

            Select Case e.Value.ToString().Length
                Case 1
                    e.CellStyle.SelectionForeColor = Color.Red
                    e.CellStyle.ForeColor = Color.Red
                Case 2
                    e.CellStyle.SelectionForeColor = Color.Yellow
                    e.CellStyle.ForeColor = Color.Yellow
                Case 3
                    e.CellStyle.SelectionForeColor = Color.Green
                    e.CellStyle.ForeColor = Color.Green
                Case 4
                    e.CellStyle.SelectionForeColor = Color.Blue
                    e.CellStyle.ForeColor = Color.Blue
            End Select

        End If

    End Sub

    ' Creates the columns and loads the data.
    Private Sub PopulateDataGridView()

        ' Set the column header names.
        dataGridView1.ColumnCount = 5
        dataGridView1.Columns(0).Name = "Recipe"
        dataGridView1.Columns(1).Name = "Category"
        dataGridView1.Columns(2).Name = "Main Ingredients"
        dataGridView1.Columns(3).Name = "Last Prepared"
        dataGridView1.Columns(4).Name = "Rating"

        ' Populate the rows.
        Dim row1() As Object
 = {"Meatloaf", "Main Dish",
 _
            "ground beef", New
 DateTime(2000, 3, 23), "*"}
        Dim row2() As Object
 = {"Key Lime Pie", "Dessert",
 _
            "lime juice, evaporated milk", New
 DateTime(2002, 4, 12), "****"}
        Dim row3() As Object
 = {"Orange-Salsa Pork Chops", "Main
 Dish", _
            "pork chops, salsa, orange juice", New
 DateTime(2000, 8, 9), "****"}
        Dim row4() As Object
 = {"Black Bean and Rice Salad", "Salad",
 _
            "black beans, brown rice", New
 DateTime(1999, 5, 7), "****"}
        Dim row5() As Object
 = {"Chocolate Cheesecake", "Dessert",
 _
            "cream cheese", New
 DateTime(2003, 3, 12), "***"}
        Dim row6() As Object
 = {"Black Bean Dip", "Appetizer",
 _
            "black beans, sour cream", New
 DateTime(2003, 12, 23), "***"}

        ' Add the rows to the DataGridView.
        Dim rows() As Object
 = {row1, row2, row3, row4, row5, row6}
        Dim rowArray As Object()
        For Each rowArray In
 rows
            dataGridView1.Rows.Add(rowArray)
        Next rowArray

        ' Adjust the row heights so that all content is visible.
        dataGridView1.AutoResizeRows( _
            DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders)

    End Sub
End Class
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
    [STAThreadAttribute()]
    public static void Main()
    {
        Application.Run(new Form1());
    }

    private DataGridView dataGridView1 = new
 DataGridView();

    protected override void OnLoad(EventArgs
 e)
    {
        // Create the columns and load the data.
        PopulateDataGridView();

        // Configure the appearance and behavior of the DataGridView.
        InitializeDataGridView();

        // Initialize the form.
        this.Text = "DataGridView style demo";
        this.Size = new Size(600, 250);
        this.Controls.Add(dataGridView1);
        base.OnLoad(e);
    }

    // Configures the appearance and behavior of a DataGridView control.
    private void InitializeDataGridView()
    {
        // Initialize basic DataGridView properties.
        dataGridView1.Dock = DockStyle.Fill;
        dataGridView1.BackgroundColor = Color.LightGray;
        dataGridView1.BorderStyle = BorderStyle.Fixed3D;

        // Set property values appropriate for read-only display and
 
        // limited interactivity. 
        dataGridView1.AllowUserToAddRows = false;
        dataGridView1.AllowUserToDeleteRows = false;
        dataGridView1.AllowUserToOrderColumns = true;
        dataGridView1.ReadOnly = true;
        dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
        dataGridView1.MultiSelect = false;
        dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
        dataGridView1.AllowUserToResizeColumns = false;
        dataGridView1.ColumnHeadersHeightSizeMode = 
            DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
        dataGridView1.AllowUserToResizeRows = false;
        dataGridView1.RowHeadersWidthSizeMode = 
            DataGridViewRowHeadersWidthSizeMode.DisableResizing;

        // Set the selection background color for all the cells.
        dataGridView1.DefaultCellStyle.SelectionBackColor = Color.White;
        dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Black;

        // Set RowHeadersDefaultCellStyle.SelectionBackColor so that
 its default
        // value won't override DataGridView.DefaultCellStyle.SelectionBackColor.
        dataGridView1.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty;

        // Set the background color for all rows and for alternating
 rows. 
        // The value for alternating rows overrides the value for all
 rows. 
        dataGridView1.RowsDefaultCellStyle.BackColor = Color.LightGray;
        dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.DarkGray;

        // Set the row and column header styles.
        dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
        dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
        dataGridView1.RowHeadersDefaultCellStyle.BackColor = Color.Black;

        // Set the Format property on the "Last Prepared"
 column to cause
        // the DateTime to be formatted as "Month, Year".
        dataGridView1.Columns["Last Prepared"].DefaultCellStyle.Format
 = "y";

        // Specify a larger font for the "Ratings" column.
 
        using (Font font = new Font(
            dataGridView1.DefaultCellStyle.Font.FontFamily, 25, FontStyle.Bold))
        {
            dataGridView1.Columns["Rating"].DefaultCellStyle.Font = font;
        }

        // Attach a handler to the CellFormatting event.
        dataGridView1.CellFormatting += new
            DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);
    }

    // Changes the foreground color of cells in the "Ratings"
 column 
    // depending on the number of stars. 
    private void dataGridView1_CellFormatting(object
 sender,
        DataGridViewCellFormattingEventArgs e)
    {
        if (e.ColumnIndex == dataGridView1.Columns["Rating"].Index
            && e.Value != null)
        {
            switch (e.Value.ToString().Length)
            {
                case 1:
                    e.CellStyle.SelectionForeColor = Color.Red;
                    e.CellStyle.ForeColor = Color.Red;
                    break;
                case 2:
                    e.CellStyle.SelectionForeColor = Color.Yellow;
                    e.CellStyle.ForeColor = Color.Yellow;
                    break;
                case 3:
                    e.CellStyle.SelectionForeColor = Color.Green;
                    e.CellStyle.ForeColor = Color.Green;
                    break;
                case 4:
                    e.CellStyle.SelectionForeColor = Color.Blue;
                    e.CellStyle.ForeColor = Color.Blue;
                    break;
            }
        }
    }

    // Creates the columns and loads the data.
    private void PopulateDataGridView()
    {
        // Set the column header names.
        dataGridView1.ColumnCount = 5;
        dataGridView1.Columns[0].Name = "Recipe";
        dataGridView1.Columns[1].Name = "Category";
        dataGridView1.Columns[2].Name = "Main Ingredients";
        dataGridView1.Columns[3].Name = "Last Prepared";
        dataGridView1.Columns[4].Name = "Rating";

        // Populate the rows.
        object[] row1 = new object[]{"Meatloaf", "Main
 Dish", 
            "ground beef", new DateTime(2000, 3, 23),
 "*"};
        object[] row2 = new object[]{"Key Lime Pie",
 "Dessert", 
            "lime juice, evaporated milk", new DateTime(2002,
 4, 12), "****"};
        object[] row3 = new object[]{"Orange-Salsa Pork Chops",
 "Main Dish", 
            "pork chops, salsa, orange juice", new DateTime(2000,
 8, 9), "****"};
        object[] row4 = new object[]{"Black Bean and Rice
 Salad", "Salad", 
            "black beans, brown rice", new DateTime(1999,
 5, 7), "****"};
        object[] row5 = new object[]{"Chocolate Cheesecake",
 "Dessert", 
            "cream cheese", new DateTime(2003, 3, 12),
 "***"};
        object[] row6 = new object[]{"Black Bean Dip",
 "Appetizer",
            "black beans, sour cream", new DateTime(2003,
 12, 23), "***"};

        // Add the rows to the DataGridView.
        object[] rows = new object[] { row1, row2, row3, row4,
 row5, row6 };
        foreach (object[] rowArray in rows)
        {
            dataGridView1.Rows.Add(rowArray);
        }

        // Adjust the row heights so that all content is visible.
        dataGridView1.AutoResizeRows(
            DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders);
    }

}
継承階層継承階層
System.Object
  System.Windows.Forms.DataGridViewCellStyle
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCellStyle メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.DefaultCellStyle プロパティ
DataGridView.RowsDefaultCellStyle プロパティ
DataGridView.AlternatingRowsDefaultCellStyle プロパティ
DataGridView.ColumnHeadersDefaultCellStyle プロパティ
DataGridView.RowHeadersDefaultCellStyle プロパティ
DataGridView.CellFormatting イベント
DataGridView.CellStyleContentChanged イベント
DataGridViewBand.InheritedStyle プロパティ
DataGridViewBand.DefaultCellStyle プロパティ
DataGridViewRow.DefaultCellStyle
DataGridViewColumn.DefaultCellStyle
DataGridViewCell.InheritedStyle プロパティ
DataGridViewCell.Style プロパティ
DataGridViewCellFormattingEventArgs クラス
その他の技術情報
Windows フォーム DataGridView コントロールでのセルスタイル
DataGridView コントロール概要 (Windows フォーム)

DataGridViewCellStyle コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

既定プロパティ値を使用して DataGridViewCellStyle クラス新しインスタンス初期化します。

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

Dim instance As New DataGridViewCellStyle
public DataGridViewCellStyle ()
public:
DataGridViewCellStyle ()
public DataGridViewCellStyle ()
public function DataGridViewCellStyle ()
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataGridViewCellStyle コンストラクタ (DataGridViewCellStyle)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定した DataGridViewCellStyleプロパティ値を使用して DataGridViewCellStyle クラス新しインスタンス初期化します。

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

Public Sub New ( _
    dataGridViewCellStyle As DataGridViewCellStyle _
)
Dim dataGridViewCellStyle As DataGridViewCellStyle

Dim instance As New DataGridViewCellStyle(dataGridViewCellStyle)
public DataGridViewCellStyle (
    DataGridViewCellStyle dataGridViewCellStyle
)
public:
DataGridViewCellStyle (
    DataGridViewCellStyle^ dataGridViewCellStyle
)
public DataGridViewCellStyle (
    DataGridViewCellStyle dataGridViewCellStyle
)
public function DataGridViewCellStyle (
    dataGridViewCellStyle : DataGridViewCellStyle
)

パラメータ

dataGridViewCellStyle

初期プロパティ値を決定するテンプレートとして使用される DataGridViewCellStyle。

例外例外
例外種類条件

ArgumentNullException

dataGridViewCellStylenull 参照 (Visual Basic では Nothing) です。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DataGridViewCellStyle コンストラクタ

DataGridViewCellStyle クラス新しインスタンス初期化します。 DataGridView Windows フォーム DataGridView コントロールでのセルスタイル
オーバーロードの一覧オーバーロードの一覧

名前 説明
DataGridViewCellStyle () 既定プロパティ値を使用して DataGridViewCellStyle クラス新しインスタンス初期化します。
DataGridViewCellStyle (DataGridViewCellStyle) 指定した DataGridViewCellStyleプロパティ値を使用して DataGridViewCellStyle クラス新しインスタンス初期化します。
参照参照

関連項目

DataGridViewCellStyle クラス
DataGridViewCellStyle メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView クラス

その他の技術情報

Windows フォーム DataGridView コントロールでのセルスタイル
Windows フォーム DataGridView コントロールでのセルスタイル

DataGridViewCellStyle プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ Alignment DataGridView のセルにおけるセル内容の場所を示す値を取得または設定します
パブリック プロパティ BackColor DataGridViewセル背景色取得または設定します
パブリック プロパティ DataSourceNullValue ユーザーセルnull 値を入力したときにデータ ソース保存される値を取得または設定します
パブリック プロパティ Font DataGridViewセル含まれるテキスト形式内容適用されるフォント取得または設定します
パブリック プロパティ ForeColor DataGridViewセル前景色を取得または設定します
パブリック プロパティ Format DataGridViewセル含まれるテキスト形式内容適用される書式指定文字列取得または設定します
パブリック プロパティ FormatProvider DataGridViewセル値にカルチャ固有の書式指定適用するために使用するオブジェクト取得または設定します
パブリック プロパティ IsDataSourceNullValueDefault DataSourceNullValue プロパティ設定されているかどうかを示す値を取得します
パブリック プロパティ IsFormatProviderDefault FormatProvider プロパティ設定されているかどうかを示す値を取得します
パブリック プロパティ IsNullValueDefault NullValue プロパティ設定されているかどうかを示す値を取得します
パブリック プロパティ NullValue セル値が DBNull.Value または null 参照 (Visual Basic では Nothing) である場合DataGridViewセル表示する値を取得または設定します
パブリック プロパティ Padding DataGridViewCell の端とその内容との間隔取得または設定します
パブリック プロパティ SelectionBackColor DataGridViewセル選択されたときに使用する背景色取得または設定します
パブリック プロパティ SelectionForeColor DataGridViewセル選択されたときに使用する前景色を取得または設定します
パブリック プロパティ Tag DataGridViewCellStyle に関する追加データ格納するオブジェクト取得または設定します
パブリック プロパティ WrapMode DataGridViewセル含まれるテキスト形式内容が 1 行に収まらないほど長い場合に、次の行に折り返されるか、切り捨てられるかを示す値を取得または設定します
参照参照

関連項目

DataGridViewCellStyle クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.DefaultCellStyle プロパティ
DataGridView.RowsDefaultCellStyle プロパティ
DataGridView.AlternatingRowsDefaultCellStyle プロパティ
DataGridView.ColumnHeadersDefaultCellStyle プロパティ
DataGridView.RowHeadersDefaultCellStyle プロパティ
DataGridView.CellFormatting イベント
DataGridView.CellStyleContentChanged イベント
DataGridViewBand.InheritedStyle プロパティ
DataGridViewBand.DefaultCellStyle プロパティ
DataGridViewRow.DefaultCellStyle
DataGridViewColumn.DefaultCellStyle
DataGridViewCell.InheritedStyle プロパティ
DataGridViewCell.Style プロパティ
DataGridViewCellFormattingEventArgs クラス

その他の技術情報

Windows フォーム DataGridView コントロールでのセルスタイル
DataGridView コントロール概要 (Windows フォーム)

DataGridViewCellStyle メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.ICloneable.Clone 対象DataGridViewCellStyle同一コピー作成します
参照参照

関連項目

DataGridViewCellStyle クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.DefaultCellStyle プロパティ
DataGridView.RowsDefaultCellStyle プロパティ
DataGridView.AlternatingRowsDefaultCellStyle プロパティ
DataGridView.ColumnHeadersDefaultCellStyle プロパティ
DataGridView.RowHeadersDefaultCellStyle プロパティ
DataGridView.CellFormatting イベント
DataGridView.CellStyleContentChanged イベント
DataGridViewBand.InheritedStyle プロパティ
DataGridViewBand.DefaultCellStyle プロパティ
DataGridViewRow.DefaultCellStyle
DataGridViewColumn.DefaultCellStyle
DataGridViewCell.InheritedStyle プロパティ
DataGridViewCell.Style プロパティ
DataGridViewCellFormattingEventArgs クラス

その他の技術情報

Windows フォーム DataGridView コントロールでのセルスタイル
DataGridView コントロール概要 (Windows フォーム)

DataGridViewCellStyle メンバ

DataGridView コントロール内のセル適用される書式指定情報およびスタイル情報表します

DataGridViewCellStyle データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DataGridViewCellStyle オーバーロードされます。 DataGridViewCellStyle クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ Alignment DataGridViewセルにおけるセル内容の場所を示す値を取得または設定します
パブリック プロパティ BackColor DataGridViewセル背景色取得または設定します
パブリック プロパティ DataSourceNullValue ユーザーセルnull 値を入力したときにデータ ソース保存される値を取得または設定します
パブリック プロパティ Font DataGridViewセル含まれるテキスト形式内容適用されるフォント取得または設定します
パブリック プロパティ ForeColor DataGridViewセル前景色を取得または設定します
パブリック プロパティ Format DataGridViewセル含まれるテキスト形式内容適用される書式指定文字列取得または設定します
パブリック プロパティ FormatProvider DataGridViewセル値にカルチャ固有の書式指定適用するために使用するオブジェクト取得または設定します
パブリック プロパティ IsDataSourceNullValueDefault DataSourceNullValue プロパティ設定されているかどうかを示す値を取得します
パブリック プロパティ IsFormatProviderDefault FormatProvider プロパティ設定されているかどうかを示す値を取得します
パブリック プロパティ IsNullValueDefault NullValue プロパティ設定されているかどうかを示す値を取得します
パブリック プロパティ NullValue セル値が DBNull.Value または null 参照 (Visual Basic では Nothing) である場合DataGridViewセル表示する値を取得または設定します
パブリック プロパティ Padding DataGridViewCell の端とその内容との間隔取得または設定します
パブリック プロパティ SelectionBackColor DataGridViewセル選択されたときに使用する背景色取得または設定します
パブリック プロパティ SelectionForeColor DataGridViewセル選択されたときに使用する前景色を取得または設定します
パブリック プロパティ Tag DataGridViewCellStyle に関する追加データ格納するオブジェクト取得または設定します
パブリック プロパティ WrapMode DataGridViewセル含まれるテキスト形式内容が 1 行に収まらないほど長い場合に、次の行に折り返されるか、切り捨てられるかを示す値を取得または設定します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.ICloneable.Clone 対象DataGridViewCellStyle同一コピー作成します
参照参照

関連項目

DataGridViewCellStyle クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridView.DefaultCellStyle プロパティ
DataGridView.RowsDefaultCellStyle プロパティ
DataGridView.AlternatingRowsDefaultCellStyle プロパティ
DataGridView.ColumnHeadersDefaultCellStyle プロパティ
DataGridView.RowHeadersDefaultCellStyle プロパティ
DataGridView.CellFormatting イベント
DataGridView.CellStyleContentChanged イベント
DataGridViewBand.InheritedStyle プロパティ
DataGridViewBand.DefaultCellStyle プロパティ
DataGridViewRow.DefaultCellStyle
DataGridViewColumn.DefaultCellStyle
DataGridViewCell.InheritedStyle プロパティ
DataGridViewCell.Style プロパティ
DataGridViewCellFormattingEventArgs クラス

その他の技術情報

Windows フォーム DataGridView コントロールでのセルスタイル
DataGridView コントロール概要 (Windows フォーム)



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewCellStyle」の関連用語

DataGridViewCellStyleのお隣キーワード
検索ランキング

   

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



DataGridViewCellStyleのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS