DataGridViewColumn.HeaderCell プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As DataGridViewColumn Dim value As DataGridViewColumnHeaderCell value = instance.HeaderCell instance.HeaderCell = value
public: property DataGridViewColumnHeaderCell^ HeaderCell { DataGridViewColumnHeaderCell^ get (); void set (DataGridViewColumnHeaderCell^ value); }
/** @property */ public DataGridViewColumnHeaderCell get_HeaderCell () /** @property */ public void set_HeaderCell (DataGridViewColumnHeaderCell value)
public function get HeaderCell () : DataGridViewColumnHeaderCell public function set HeaderCell (value : DataGridViewColumnHeaderCell)
列のヘッダー セルを表す DataGridViewColumnHeaderCell。

列のヘッダーは通常、列のラベルを表示するために使用されます。SortMode プロパティと DataGridView.SelectionMode プロパティの現在値によっては、ユーザーは列ヘッダーをクリックして、列の並べ替えや選択を行うこともできます。

HeaderCell プロパティを使用して、列ヘッダーのスタイルと内容を変更するコード例を次に示します。
' Style and number columns. Private Sub Button8_Click(ByVal sender As Object, _ ByVal args As EventArgs) Handles Button8.Click Dim style As DataGridViewCellStyle = _ New DataGridViewCellStyle() style.Alignment = _ DataGridViewContentAlignment.MiddleCenter style.ForeColor = Color.IndianRed style.BackColor = Color.Ivory For Each column As DataGridViewColumn _ In dataGridView.Columns column.HeaderCell.Value = _ column.Index.ToString column.HeaderCell.Style = style Next End Sub
// Style and number columns. private void Button8_Click(object sender, EventArgs args) { DataGridViewCellStyle style = new DataGridViewCellStyle(); style.Alignment = DataGridViewContentAlignment.MiddleCenter; style.ForeColor = Color.IndianRed; style.BackColor = Color.Ivory; foreach (DataGridViewColumn column in dataGridView.Columns) { column.HeaderCell.Value = column.Index.ToString(); column.HeaderCell.Style = style; } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataGridViewColumnHeaderCell プロパティ

名前 | 説明 | |
---|---|---|
![]() | AccessibilityObject | DataGridViewCell に割り当てられた DataGridViewCell.DataGridViewCellAccessibleObject を取得します。 ( DataGridViewCell から継承されます。) |
![]() | ColumnIndex | このセルの列インデックスを取得します。 ( DataGridViewCell から継承されます。) |
![]() | ContentBounds | セルの内容領域を囲んだ外接する四角形を取得します。 ( DataGridViewCell から継承されます。) |
![]() | ContextMenuStrip | セルに関連付けられたショートカット メニューを取得または設定します。 ( DataGridViewCell から継承されます。) |
![]() | DataGridView | この要素に関連付けられている DataGridView コントロールを取得します。 ( DataGridViewElement から継承されます。) |
![]() | DefaultNewRowValue | 新しいレコードの行のセルに対する既定値を取得します。 ( DataGridViewCell から継承されます。) |
![]() | Displayed | ( DataGridViewHeaderCell から継承されます。) |
![]() | EditedFormattedValue | セルが編集モードであるかどうか、および値がコミットされているかどうかに関係なく、セルの現在の書式指定済みの値を取得します。 ( DataGridViewCell から継承されます。) |
![]() | EditType | セルにホストされる編集コントロールの型を取得します。 ( DataGridViewCell から継承されます。) |
![]() | ErrorIconBounds | セルのエラー アイコンの境界を取得します。 ( DataGridViewCell から継承されます。) |
![]() | ErrorText | セルに関連付けられたエラー条件を記述するテキストを取得または設定します。 ( DataGridViewCell から継承されます。) |
![]() | FormattedValue | 表示用に書式指定済みのセル値を取得します。 ( DataGridViewCell から継承されます。) |
![]() | FormattedValueType | セルの書式指定済みの値の型を取得します。 ( DataGridViewHeaderCell から継承されます。) |
![]() | Frozen | セルが固定された状態かどうかを示す値を取得します。 ( DataGridViewHeaderCell から継承されます。) |
![]() | HasStyle | Style プロパティが設定されているかどうかを示す値を取得します。 ( DataGridViewCell から継承されます。) |
![]() | InheritedState | 行と列の状態から継承されたセルの現在の状態を取得します。 ( DataGridViewCell から継承されます。) |
![]() | InheritedStyle | セルに現在適用されているスタイルを取得します。 ( DataGridViewCell から継承されます。) |
![]() | IsInEditMode | このセルが現在編集されているかどうかを示す値を取得します。 ( DataGridViewCell から継承されます。) |
![]() | OwningColumn | セルを格納している列を取得します。 ( DataGridViewCell から継承されます。) |
![]() | OwningRow | セルを格納している行を取得します。 ( DataGridViewCell から継承されます。) |
![]() | PreferredSize | セルが収まる四角形領域のサイズをピクセル単位で取得します。 ( DataGridViewCell から継承されます。) |
![]() | ReadOnly | ヘッダー セルが読み取り専用かどうかを示す値を取得します。 ( DataGridViewHeaderCell から継承されます。) |
![]() | Resizable | セルのサイズを変更できるかどうかを示す値を取得します。 ( DataGridViewHeaderCell から継承されます。) |
![]() | RowIndex | セルの親行のインデックスを取得します。 ( DataGridViewCell から継承されます。) |
![]() | Selected | セルが選択されているかどうかを示す値を取得または設定します。 ( DataGridViewHeaderCell から継承されます。) |
![]() | Size | セルのサイズを取得します。 ( DataGridViewCell から継承されます。) |
![]() | SortGlyphDirection | 表示されている並べ替えグリフを示す値を取得または設定します。 |
![]() | State | 要素のユーザー インターフェイス (UI) の状態を取得します。 ( DataGridViewElement から継承されます。) |
![]() | Style | セルのスタイルを取得または設定します。 ( DataGridViewCell から継承されます。) |
![]() | Tag | セルに関する補足的なデータを格納するオブジェクトを取得または設定します。 ( DataGridViewCell から継承されます。) |
![]() | ToolTipText | このセルに関連付けられているツールヒント テキストを取得または設定します。 ( DataGridViewCell から継承されます。) |
![]() | Value | このセルに関連付けられている値を取得または設定します。 ( DataGridViewCell から継承されます。) |
![]() | ValueType | セルに格納されている値の型を取得します。 ( DataGridViewHeaderCell から継承されます。) |
![]() | Visible | セルを表示するかどうかを示す値を取得します。 ( DataGridViewHeaderCell から継承されます。) |


- DataGridViewColumn.HeaderCell プロパティのページへのリンク