DataGridViewImageCell クラス

定義

DataGridView コントロール内にグラフィックを表示します。

public ref class DataGridViewImageCell : System::Windows::Forms::DataGridViewCell
public class DataGridViewImageCell : System.Windows.Forms.DataGridViewCell
type DataGridViewImageCell = class
    inherit DataGridViewCell
Public Class DataGridViewImageCell
Inherits DataGridViewCell
継承

次のコード例では、 を使用してイメージ セル内のイメージを変更する方法を DataGridViewCell示します。 このコード例は、「How to: Work with Image Columns in the Windows フォーム DataGridView Control」トピックで提供される大きな例の一部です。

void dataGridView1_CellClick( Object^ sender, DataGridViewCellEventArgs^ e )
{
   if ( turn->Equals( gameOverString ) )
   {
      return;
   }

   DataGridViewImageCell^ cell = dynamic_cast<DataGridViewImageCell^>(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]);
   if ( cell->Value == blank )
   {
      if ( IsOsTurn() )
      {
         cell->Value = o;
      }
      else
      {
         cell->Value = x;
      }

      ToggleTurn();
   }

   if ( IsAWin( cell ) )
   {
      turn->Text = gameOverString;
   }
}
private void dataGridView1_CellClick(object sender,
    DataGridViewCellEventArgs e)
{

    if (turn.Text.Equals(gameOverString)) { return; }

    DataGridViewImageCell cell = (DataGridViewImageCell)
        dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];

    if (cell.Value == blank)
    {
        if (IsOsTurn())
        {
            cell.Value = o;
        }
        else
        {
            cell.Value = x;
        }
        ToggleTurn();
    }
    if (IsAWin())
    {
        turn.Text = gameOverString;
    }
}
Private Sub dataGridView1_CellClick(ByVal sender As Object, _
    ByVal e As DataGridViewCellEventArgs) _
    Handles dataGridView1.CellClick

    If turn.Text.Equals(gameOverString) Then Return

    Dim cell As DataGridViewImageCell = _
        CType(dataGridView1.Rows(e.RowIndex). _
            Cells(e.ColumnIndex), DataGridViewImageCell)
    If (cell.Value Is blank) Then
        If IsOsTurn() Then
            cell.Value = o
        Else
            cell.Value = x
        End If
        ToggleTurn()
        ToolTip(e)
    End If
    If IsAWin() Then
        turn.Text = gameOverString
    End If
End Sub

注釈

クラスはDataGridViewImageCell、 プロパティのDataGridViewCellValueIsIconに応じて、 または をIcon表示Imageするために使用される 特殊化された 型です。 通常、 の ReadOnlyDataGridViewImageCell プロパティは、 に true 設定され、ユーザーがセルの内容を編集できないことを示します。

DataGridViewImageColumnは、この型のセルを保持するために特殊化された列型です。 既定では、 DataGridViewImageColumn.CellTemplate は新 DataGridViewImageCellしい に初期化されます。 既存 DataGridViewImageCellの の後の列内のセルをパターン設定するには、パターンとして使用するセルに列の CellTemplate プロパティを設定します。

列のセル関連プロパティは、テンプレート セルの同様の名前のプロパティのラッパーです。 テンプレート セルのプロパティ値を変更すると、変更後に追加されたテンプレートに基づくセルにのみ影響します。 ただし、列のセル関連のプロパティ値を変更すると、テンプレート セルと列内の他のすべてのセルが更新され、必要に応じて列の表示が更新されます。

注意 (継承者)

から DataGridViewImageCell 派生し、派生クラスに新しいプロパティを追加するときは、 メソッドをオーバーライド Clone() して、複製操作中に新しいプロパティをコピーしてください。 基底クラスの Clone() プロパティが新しいセルにコピーされるように、基底クラスの メソッドも呼び出す必要があります。

コンストラクター

DataGridViewImageCell()

DataGridViewImageCell クラスの新しいインスタンスを初期化し、セル値が Icon オブジェクト以外の場合に使用するよう構成します。

DataGridViewImageCell(Boolean)

DataGridViewImageCell クラスの新しいインスタンスを初期化し、オプションでセル値が Icon である場合に使用するよう構成します。

プロパティ

AccessibilityObject

DataGridViewCell.DataGridViewCellAccessibleObject に割り当てられた DataGridViewCell を取得します。

(継承元 DataGridViewCell)
ColumnIndex

このセルの列インデックスを取得します。

(継承元 DataGridViewCell)
ContentBounds

セルの内容領域を囲んだ外接する四角形を取得します。

(継承元 DataGridViewCell)
ContextMenuStrip

セルに関連付けられたショートカット メニューを取得または設定します。

(継承元 DataGridViewCell)
DataGridView

この要素に関連付けられている DataGridView コントロールを取得します。

(継承元 DataGridViewElement)
DefaultNewRowValue

新しい行を作成するときに使用する既定値を取得します。

Description

イメージに関連付けられたテキストを取得または設定します。

Displayed

セルが現在画面上に表示されているかどうかを示す値を取得します。

(継承元 DataGridViewCell)
EditedFormattedValue

セルが編集モードであるかどうか、および値がコミットされているかどうかに関係なく、セルの現在の書式指定済みの値を取得します。

(継承元 DataGridViewCell)
EditType

セルのホストされる編集コントロールの型を取得します。

ErrorIconBounds

セルのエラー アイコンの境界を取得します。

(継承元 DataGridViewCell)
ErrorText

セルに関連付けられたエラー条件を記述するテキストを取得または設定します。

(継承元 DataGridViewCell)
FormattedValue

表示用に書式指定済みのセル値を取得します。

(継承元 DataGridViewCell)
FormattedValueType

セルに関連付けられている、書式設定された値の型を取得します。

Frozen

セルが固定された状態かどうかを示す値を取得します。

(継承元 DataGridViewCell)
HasStyle

Style プロパティが設定されているかどうかを示す値を取得します。

(継承元 DataGridViewCell)
ImageLayout

セルのグラフィックスのレイアウトを取得または設定します。

InheritedState

行と列の状態から継承されたセルの現在の状態を取得します。

(継承元 DataGridViewCell)
InheritedStyle

セルに現在適用されているスタイルを取得します。

(継承元 DataGridViewCell)
IsInEditMode

このセルが現在編集されているかどうかを示す値を取得します。

(継承元 DataGridViewCell)
OwningColumn

セルを格納している列を取得します。

(継承元 DataGridViewCell)
OwningRow

セルを格納している行を取得します。

(継承元 DataGridViewCell)
PreferredSize

セルが収まる四角形領域のサイズをピクセル単位で取得します。

(継承元 DataGridViewCell)
ReadOnly

セルのデータを編集できるかどうかを示す値を取得または設定します。

(継承元 DataGridViewCell)
Resizable

セルのサイズを変更できるかどうかを示す値を取得します。

(継承元 DataGridViewCell)
RowIndex

セルの親行のインデックスを取得します。

(継承元 DataGridViewCell)
Selected

セルが選択されているかどうかを示す値を取得または設定します。

(継承元 DataGridViewCell)
Size

セルのサイズを取得します。

(継承元 DataGridViewCell)
State

要素のユーザー インターフェイス (UI) の状態を取得します。

(継承元 DataGridViewElement)
Style

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

(継承元 DataGridViewCell)
Tag

セルに関する補足的なデータを格納するオブジェクトを取得または設定します。

(継承元 DataGridViewCell)
ToolTipText

このセルに関連付けられているツールヒント テキストを取得または設定します。

(継承元 DataGridViewCell)
Value

このセルに関連付けられている値を取得または設定します。

(継承元 DataGridViewCell)
ValueIsIcon

このセルに Icon 値を表示するかどうかを示す値を取得または設定します。

ValueType

セル内の値のデータ型を取得または設定します。

Visible

非表示にされた行または列にセルが含まれるかどうかを示す値を取得します。

(継承元 DataGridViewCell)

メソッド

AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean)

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

(継承元 DataGridViewCell)
BorderWidths(DataGridViewAdvancedBorderStyle)

すべてのセル マージンの幅を表す Rectangle を返します。

(継承元 DataGridViewCell)
ClickUnsharesRow(DataGridViewCellEventArgs)

セルがクリックされたときに、セルの行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
Clone()

対象のセルの同一コピーを作成します。

ContentClickUnsharesRow(DataGridViewCellEventArgs)

セルの内容がクリックされたときに、セルの行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs)

セルの内容がダブルクリックされたときに、セルの行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
CreateAccessibilityInstance()

DataGridViewImageCell の新しいユーザー補助オブジェクトを作成します。

DetachEditingControl()

セルの編集コントロールを DataGridView から削除します。

(継承元 DataGridViewCell)
Dispose()

DataGridViewCell によって使用されているすべてのリソースを解放します。

(継承元 DataGridViewCell)
Dispose(Boolean)

DataGridViewCell によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。

(継承元 DataGridViewCell)
DoubleClickUnsharesRow(DataGridViewCellEventArgs)

セルがダブルクリックされたときに、セルの行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
EnterUnsharesRow(Int32, Boolean)

フォーカスがセルに移動したときに、親の行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetClipboardContent(Int32, Boolean, Boolean, Boolean, Boolean, String)

Clipboard にコピーするセルの書式指定済みの値を取得します。

(継承元 DataGridViewCell)
GetContentBounds(Graphics, DataGridViewCellStyle, Int32)

セルの内容領域に外接する四角形を返します。これは、指定された Graphics とセル スタイルを使って計算されます。

GetContentBounds(Int32)

既定の Graphics、およびセルに現在有効なセル スタイルを使用して、セルの内容領域を囲む外接する四角形を返します。

(継承元 DataGridViewCell)
GetEditedFormattedValue(Int32, DataGridViewDataErrorContexts)

セルが編集モードであるかどうか、および値がコミットされているかどうかに関係なく、セルの現在の書式指定済みの値を返します。

(継承元 DataGridViewCell)
GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32)

セルのエラー アイコンが表示されている場合に、そのエラー アイコンを囲む外接する四角形を返します。

GetErrorText(Int32)

セルのエラーを表す文字列を返します。

(継承元 DataGridViewCell)
GetFormattedValue(Object, Int32, DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts)

セルに表示されるグラフィックを返します。

GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetInheritedContextMenuStrip(Int32)

現在のセルの継承されたショートカット メニューを取得します。

(継承元 DataGridViewCell)
GetInheritedState(Int32)

行および列の状態から継承されたセルの現在の状態を示す値を返します。

(継承元 DataGridViewCell)
GetInheritedStyle(DataGridViewCellStyle, Int32, Boolean)

セルに適用されるスタイルを取得します。

(継承元 DataGridViewCell)
GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size)

セルの推奨されるサイズをピクセル単位で計算します。

GetSize(Int32)

セルのサイズを取得します。

(継承元 DataGridViewCell)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetValue(Int32)

セルの値を取得します。

InitializeEditingControl(Int32, Object, DataGridViewCellStyle)

セルの編集に使用されるコントロールを初期化します。

(継承元 DataGridViewCell)
KeyDownUnsharesRow(KeyEventArgs, Int32)

セルにフォーカスがある状態でキーを押したときに、親の行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
KeyEntersEditMode(KeyEventArgs)

押されたキーに基づいて編集モードを開始するかどうかを決定します。

(継承元 DataGridViewCell)
KeyPressUnsharesRow(KeyPressEventArgs, Int32)

行内のセルにフォーカスがあるときにキーが押された場合に、行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
KeyUpUnsharesRow(KeyEventArgs, Int32)

セルにフォーカスがある状態でキーを離したときに、親の行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
LeaveUnsharesRow(Int32, Boolean)

フォーカスが行のセルを離れたときに、その行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
MouseClickUnsharesRow(DataGridViewCellMouseEventArgs)

マウス ポインターを行のセルに置いた状態でマウス ボタンをクリックしたときに、その行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
MouseDoubleClickUnsharesRow(DataGridViewCellMouseEventArgs)

行内のセルをダブルクリックした場合に、その行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
MouseDownUnsharesRow(DataGridViewCellMouseEventArgs)

マウス ポインターを行のセルに置いた状態でマウス ボタンを押したままにしたときに、その行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
MouseEnterUnsharesRow(Int32)

マウス ポインターを行のセル上に移動したときに行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
MouseLeaveUnsharesRow(Int32)

マウス ポインターを行から離したときに行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs)

マウス ポインターを行のセル上に移動したときに行の共有を解除するかどうかを示します。

(継承元 DataGridViewCell)
MouseUpUnsharesRow(DataGridViewCellMouseEventArgs)

マウス ポインターを行のセルに置いた状態でマウス ボタンを離したときに、その行を非共有にするかどうかを示します。

(継承元 DataGridViewCell)
OnClick(DataGridViewCellEventArgs)

セルがクリックされたときに呼び出されます。

(継承元 DataGridViewCell)
OnContentClick(DataGridViewCellEventArgs)

セルの内容がクリックされたときに呼び出されます。

(継承元 DataGridViewCell)
OnContentDoubleClick(DataGridViewCellEventArgs)

セルの内容がダブルクリックされたときに呼び出されます。

(継承元 DataGridViewCell)
OnDataGridViewChanged()

セルの DataGridView プロパティが変更された場合に発生します。

(継承元 DataGridViewCell)
OnDoubleClick(DataGridViewCellEventArgs)

セルがダブルクリックされたときに呼び出されます。

(継承元 DataGridViewCell)
OnEnter(Int32, Boolean)

フォーカスがセルに移動するときに呼び出されます。

(継承元 DataGridViewCell)
OnKeyDown(KeyEventArgs, Int32)

セルにフォーカスがある状態で文字キーが押されたときに呼び出されます。

(継承元 DataGridViewCell)
OnKeyPress(KeyPressEventArgs, Int32)

セルにフォーカスがある状態でキーが押されたときに呼び出されます。

(継承元 DataGridViewCell)
OnKeyUp(KeyEventArgs, Int32)

セルにフォーカスがある状態で文字キーを離したときに呼び出されます。

(継承元 DataGridViewCell)
OnLeave(Int32, Boolean)

フォーカスがセルから離れるときに呼び出されます。

(継承元 DataGridViewCell)
OnMouseClick(DataGridViewCellMouseEventArgs)

マウス ポインターがセル上にあるときにマウス ボタンをクリックすると呼び出されます。

(継承元 DataGridViewCell)
OnMouseDoubleClick(DataGridViewCellMouseEventArgs)

マウス ポインターがセル上にあるときにマウス ボタンをダブルクリックすると呼び出されます。

(継承元 DataGridViewCell)
OnMouseDown(DataGridViewCellMouseEventArgs)

マウス ポインターがセル上にあるときにマウス ボタンを押したままにすると呼び出されます。

(継承元 DataGridViewCell)
OnMouseEnter(Int32)

マウス ポインターがセル上を移動すると呼び出されます。

(継承元 DataGridViewCell)
OnMouseLeave(Int32)

マウス ポインターをセルから離すと呼び出されます。

(継承元 DataGridViewCell)
OnMouseMove(DataGridViewCellMouseEventArgs)

マウス ポインターがセル内で移動すると呼び出されます。

(継承元 DataGridViewCell)
OnMouseUp(DataGridViewCellMouseEventArgs)

マウス ポインターがセル上にあるときにマウス ボタンを離すと呼び出されます。

(継承元 DataGridViewCell)
Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts)

現在の DataGridViewImageCell を描画します。

PaintBorder(Graphics, Rectangle, Rectangle, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle)

現在の DataGridViewCell の境界線を描画します。

(継承元 DataGridViewCell)
PaintErrorIcon(Graphics, Rectangle, Rectangle, String)

現在の DataGridViewCell のエラー アイコンを描画します。

(継承元 DataGridViewCell)
ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter)

表示用に書式設定された値を、実際のセル値に変換します。

(継承元 DataGridViewCell)
PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean)

DataGridView コントロールのセルによってホストされる編集コントロールの位置とサイズを設定します。

(継承元 DataGridViewCell)
PositionEditingPanel(Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean)

セルによってホストされる編集パネルの位置とサイズを設定し、編集パネル内の編集コントロールの標準の境界を返します。

(継承元 DataGridViewCell)
RaiseCellClick(DataGridViewCellEventArgs)

CellClick イベントを発生させます。

(継承元 DataGridViewElement)
RaiseCellContentClick(DataGridViewCellEventArgs)

CellContentClick イベントを発生させます。

(継承元 DataGridViewElement)
RaiseCellContentDoubleClick(DataGridViewCellEventArgs)

CellContentDoubleClick イベントを発生させます。

(継承元 DataGridViewElement)
RaiseCellValueChanged(DataGridViewCellEventArgs)

CellValueChanged イベントを発生させます。

(継承元 DataGridViewElement)
RaiseDataError(DataGridViewDataErrorEventArgs)

DataError イベントを発生させます。

(継承元 DataGridViewElement)
RaiseMouseWheel(MouseEventArgs)

MouseWheel イベントを発生させます。

(継承元 DataGridViewElement)
SetValue(Int32, Object)

セルの値を設定します。

(継承元 DataGridViewCell)
ToString()

現在のオブジェクトを説明する文字列を返します。

適用対象

こちらもご覧ください