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

DataGridViewImageColumn イベント


パブリック イベントパブリック イベント

  名前 説明
パブリック イベント Disposed  DataGridViewColumn が破棄されたときに発生します。 ( DataGridViewColumn から継承されます。)
参照参照

関連項目

DataGridViewImageColumn クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewColumn クラス
DataGridViewRow
DataGridViewImageCell クラス
DataGridViewImageCell.ValueIsIcon
Image
Icon
DataGridViewColumn.SortMode プロパティ

DataGridViewImageColumn クラス

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

DataGridViewImageCell オブジェクトコレクションホストます。

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

Public Class DataGridViewImageColumn
    Inherits DataGridViewColumn
Dim instance As DataGridViewImageColumn
public class DataGridViewImageColumn : DataGridViewColumn
public ref class DataGridViewImageColumn :
 public DataGridViewColumn
public class DataGridViewImageColumn extends
 DataGridViewColumn
public class DataGridViewImageColumn extends
 DataGridViewColumn
解説解説

DataGridViewImageColumn クラスは、DataGridViewColumn クラス特殊な型で、イメージ表示するセル論理的にホストするために使用されます。DataGridViewImageColumn には、それと交差するすべての DataGridViewRow 内に、関連付けられた DataGridViewImageCellあります。各セルには、DataGridViewImageCell.ValueIsIcon プロパティの値に応じてImage または Icon格納できますイメージ透明度持たせる場合は、アイコン表示すると便利です。

既定では、空のセルには既定エラー グラフィック表示されます。セルの値が null 参照 (Visual Basic では Nothing) または DBNull.Value である場合にこのグラフィック表示されないようにするには、コントロールに行を追加する前に、DefaultCellStyle プロパティによって返されるセル スタイル オブジェクトの DataGridViewCellStyle.NullValue プロパティnull 参照 (Visual Basic では Nothing) に設定します。ただし、この設定新しレコードの行には適用されません。コントロールの AllowUserToAddRows プロパティの値が true である場合に、新しレコードの行にエラー グラフィック表示されないようにするには、コントロールの RowsAdded イベントハンドラ内でセルの値を明示的に null 参照 (Visual Basic では Nothing) に設定するか、DefaultNewRowValue プロパティオーバーライドして null 参照 (Visual Basic では Nothing) を返すようにした DataGridViewImageCell派生型インスタンスを、列の CellTemplate プロパティ設定する必要があります

この列型の既定並べ替えモードは、NotSortable です。

継承時の注意 DataGridViewImageColumn からクラス派生させて新しプロパティ追加する場合は、Clone メソッドオーバーライドして、クローン操作時に新しプロパティコピーする必要がありますまた、基本クラスClone メソッド呼び出して基本クラスプロパティ新しセルコピーされるようにする必要があります

使用例使用例

次のコード例は、イメージ使用して三目並べゲーム作成する方法示してます。

Imports System.IO
Imports System.Windows.Forms
Imports System.Drawing
Imports System

Public Class TicTacToe
    Inherits System.Windows.Forms.Form

    Friend WithEvents dataGridView1 As
 DataGridView
    Friend WithEvents Button1 As
 Button = New Button()
    Friend WithEvents turn As
 Label = New Label()
    Friend WithEvents Button2 As
 Button = New Button()
    Friend WithEvents Button3 As
 Button = New Button()
    Friend WithEvents Button4 As
 Button = New Button()
    Friend WithEvents Button5 As
 Button = New Button()
    Friend WithEvents Panel1 As
 FlowLayoutPanel = New FlowLayoutPanel()

#Region "bitmaps"
    Private oImage As Byte()
 = { _
        &H42, &H4D, &HC6, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H76, &H0, &H0, &H0, &H28, &H0,
 _
        &H0, &H0, &HB, &H0, &H0, &H0, &HA, &H0, _
        &H0, &H0, &H1, &H0, &H4, &H0, &H0, &H0, _
        &H0, &H0, &H50, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H0, &H0, &H0, &H0, &H10, &H0,
 _
        &H0, &H0, &H10, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H0, &H0, &H80, &H0, &H0, &H80,
 _
        &H0, &H0, &H0, &H80, &H80, &H0, &H80, &H0,
 _
        &H0, &H0, &H80, &H0, &H80, &H0, &H80, &H80,
 _
        &H0, &H0, &HC0, &HC0, &HC0, &H0, &H80, &H80,
 _
        &H80, &H0, &H0, &H0, &HFF, &H0, &H0, &HFF,
 _
        &H0, &H0, &H0, &HFF, &HFF, &H0, &HFF, &H0,
 _
        &H0, &H0, &HFF, &H0, &HFF, &H0, &HFF, &HFF,
 _
        &H0, &H0, &HFF, &HFF, &HFF, &H0, &HFF, &HFF,
 _
        &H0, &HF, &HFF, &HF0, &H0, &H0, &HFF, &H0,
 _
        &HFF, &HF0, &HF, &HF0, &H0, &H0, &HF0, &HFF,
 _
        &HFF, &HFF, &HF0, &HF0, &H0, &H0, &HF0, &HFF,
 _
        &HFF, &HFF, &HF0, &HF0, &H0, &H0, &HF, &HFF,
 _
        &HFF, &HFF, &HFF, &H0, &H0, &H0, &HF, &HFF,
 _
        &HFF, &HFF, &HFF, &H0, &H0, &H0, &HF0, &HFF,
 _
        &HFF, &HFF, &HF0, &HF0, &H0, &H0, &HF0, &HFF,
 _
        &HFF, &HFF, &HF0, &HF0, &H0, &H0, &HFF, &H0,
 _
        &HFF, &HF0, &HF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &H0, &HF, &HFF, &HF0, &H0, &H0}

    Private xImage As Byte()
 = { _
        &H42, &H4D, &HC6, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H76, &H0, &H0, &H0, &H28, &H0,
 _
        &H0, &H0, &HB, &H0, &H0, &H0, &HA, &H0, _
        &H0, &H0, &H1, &H0, &H4, &H0, &H0, &H0, _
        &H0, &H0, &H50, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H0, &H0, &H0, &H0, &H10, &H0,
 _
        &H0, &H0, &H10, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H0, &H0, &H80, &H0, &H0, &H80,
 _
        &H0, &H0, &H0, &H80, &H80, &H0, &H80, &H0,
 _
        &H0, &H0, &H80, &H0, &H80, &H0, &H80, &H80,
 _
        &H0, &H0, &HC0, &HC0, &HC0, &H0, &H80, &H80,
 _
        &H80, &H0, &H0, &H0, &HFF, &H0, &H0, &HFF,
 _
        &H0, &H0, &H0, &HFF, &HFF, &H0, &HFF, &H0,
 _
        &H0, &H0, &HFF, &H0, &HFF, &H0, &HFF, &HFF,
 _
        &H0, &H0, &HFF, &HFF, &HFF, &H0, &HF0, &HFF,
 _
        &HFF, &HFF, &HF0, &HF0, &H0, &H0, &HFF, &HF,
 _
        &HFF, &HFF, &HF, &HF0, &H0, &H0, &HFF, &HF0,
 _
        &HFF, &HF0, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HF, &HF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HF, &HF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HF, &HF, &HFF, &HF0, &H0, &H0, &HFF, &HF0,
 _
        &HFF, &HF0, &HFF, &HF0, &H0, &H0, &HFF, &HF,
 _
        &HFF, &HFF, &HF, &HF0, &H0, &H0, &HF0, &HFF,
 _
        &HFF, &HFF, &HF0, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0}

    Private blankImage As Byte()
 = { _
        &H42, &H4D, &HC6, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H76, &H0, &H0, &H0, &H28, &H0,
 _
        &H0, &H0, &HB, &H0, &H0, &H0, &HA, &H0, _
        &H0, &H0, &H1, &H0, &H4, &H0, &H0, &H0, _
        &H0, &H0, &H50, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H0, &H0, &H0, &H0, &H10, &H0,
 _
        &H0, &H0, &H10, &H0, &H0, &H0, &H0, &H0,
 _
        &H0, &H0, &H0, &H0, &H80, &H0, &H0, &H80,
 _
        &H0, &H0, &H0, &H80, &H80, &H0, &H80, &H0,
 _
        &H0, &H0, &H80, &H0, &H80, &H0, &H80, &H80,
 _
        &H0, &H0, &HC0, &HC0, &HC0, &H0, &H80, &H80,
 _
        &H80, &H0, &H0, &H0, &HFF, &H0, &H0, &HFF,
 _
        &H0, &H0, &H0, &HFF, &HFF, &H0, &HFF, &H0,
 _
        &H0, &H0, &HFF, &H0, &HFF, &H0, &HFF, &HFF,
 _
        &H0, &H0, &HFF, &HFF, &HFF, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0, &HFF, &HFF,
 _
        &HFF, &HFF, &HFF, &HF0, &H0, &H0}
#End Region

    Private blank As Bitmap = New
 Bitmap( _
        New MemoryStream(blankImage))
    Private x As Bitmap = New
 Bitmap(New MemoryStream(xImage))
    Private o As Bitmap = New
 Bitmap(New MemoryStream(oImage))
    Private xString As String
 = "X's turn"
    Private oString As String
 = "O's turn"
    Private gameOverString As String
 = "Game Over"
    Private bitmapPadding As Integer
 = 6

    Private Sub InitializeDataGridView(ByVal
 sender As Object, _
        ByVal e As EventArgs) Handles
 Me.Load
        SuspendLayout()
        Panel1.SuspendLayout()

        ConfigureForm()
        SizeGrid()
        CreateColumns()
        CreateRows()

        ResumeLayout(False)
        Panel1.ResumeLayout(False)
    End Sub

    Private Sub ConfigureForm()
        AutoSize = True
        turn.Size = New System.Drawing.Size(75, 34)
        turn.TextAlign = ContentAlignment.MiddleLeft
        turn.Text = xString

        Panel1.FlowDirection = FlowDirection.TopDown
        Panel1.Location = New System.Drawing.Point(0, 8)
        Panel1.Size = New System.Drawing.Size(120, 196)

        ClientSize = New System.Drawing.Size(355, 200)
        Controls.Add(Me.Panel1)
        Text = "TicTacToe"

        dataGridView1 = New System.Windows.Forms.DataGridView
        dataGridView1.Location = New Point(120, 0)
        dataGridView1.AllowUserToAddRows = False
        Controls.Add(dataGridView1)
        SetupButtons()
    End Sub

    Private Sub SetupButtons()
        SetupButton(Button1, "Restart")
        Panel1.Controls.Add(Me.turn)
        SetupButton(Button2, "Increase Cell Size")
        SetupButton(Button3, "Stretch Images")
        SetupButton(Button4, "Zoom Images")
        SetupButton(Button5, "Normal Images")
    End Sub

    Private Sub SetupButton(ByVal
 button As Button, _
        ByVal buttonLabel As String)

        Panel1.Controls.Add(button)
        button.Text = buttonLabel
        button.AutoSize = True

    End Sub

    Private Sub CreateColumns()

        Dim imageColumn As DataGridViewImageColumn
        Dim columnCount As Integer
 = 0
        Do
            Dim unMarked As Bitmap = blank
            imageColumn = New DataGridViewImageColumn()

            ' Add twice the padding for the left and 
            ' right sides of the cell.
            imageColumn.Width = x.Width + 2 * bitmapPadding + 1

            imageColumn.Image = unMarked
            imageColumn.ImageLayout = DataGridViewImageCellLayout.NotSet
            imageColumn.Description = "default image layout"
            dataGridView1.Columns.Add(imageColumn)
            columnCount = columnCount + 1
        Loop While columnCount < 3
    End Sub

    Private Sub CreateRows()
        dataGridView1.Rows.Add()
        dataGridView1.Rows.Add()
        dataGridView1.Rows.Add()
    End Sub

    Private Sub SizeGrid()
        dataGridView1.ColumnHeadersVisible = False
        dataGridView1.RowHeadersVisible = False
        dataGridView1.AllowUserToResizeColumns = False
        dataGridView1.AllowUserToResizeRows = False
        dataGridView1.BorderStyle = BorderStyle.None

        ' Add twice the padding for the top and bottom of the cell.
 
        dataGridView1.RowTemplate.Height = x.Height + _
            2 * bitmapPadding + 1

        dataGridView1.AutoSize = True
    End Sub

    Private Sub reset(ByVal
 sender As Object, _
        ByVal e As EventArgs) _
        Handles Button1.Click

        dataGridView1.Dispose()
        InitializeDataGridView(Nothing, Nothing)
    End Sub

    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

    Private Sub dataGridView1_CellMouseEnter(ByVal
 sender As Object, _
        ByVal e As DataGridViewCellEventArgs)
 _
        Handles dataGridView1.CellMouseEnter

        Dim markingUnderMouse As Bitmap = _
            CType(dataGridView1.Rows(e.RowIndex). _
                Cells(e.ColumnIndex).Value, Bitmap)

        If markingUnderMouse Is blank Then
            dataGridView1.Cursor = Cursors.Default
        ElseIf markingUnderMouse Is o OrElse
 markingUnderMouse Is x Then
            dataGridView1.Cursor = Cursors.No
            ToolTip(e)
        End If
    End Sub

    Private Sub ToolTip( _
        ByVal e As DataGridViewCellEventArgs)

        Dim cell As DataGridViewImageCell =
 _
            CType(dataGridView1.Rows(e.RowIndex). _
            Cells(e.ColumnIndex), DataGridViewImageCell)
        Dim imageColumn As DataGridViewImageColumn
 = _
            CType(dataGridView1.Columns(cell.ColumnIndex), _
            DataGridViewImageColumn)

        cell.ToolTipText = imageColumn.Description
    End Sub

    Private Sub dataGridView1_CellMouseLeave(ByVal
 sender As Object, _
        ByVal e As DataGridViewCellEventArgs)
 _
        Handles dataGridView1.CellMouseLeave

        dataGridView1.Cursor = Cursors.Default
    End Sub

    Private Sub Stretch(ByVal
 sender As Object, _
        ByVal e As EventArgs) Handles
 Button3.Click

        For Each column As
 DataGridViewImageColumn _
            In dataGridView1.Columns
            column.ImageLayout = DataGridViewImageCellLayout.Stretch
            column.Description = "Stretched image layout"
        Next
    End Sub

    Private Sub ZoomToImage(ByVal
 sender As Object, _
        ByVal e As EventArgs) Handles
 Button4.Click

        For Each column As
 DataGridViewImageColumn _
            In dataGridView1.Columns
            column.ImageLayout = DataGridViewImageCellLayout.Zoom
            column.Description = "Zoomed image layout"
        Next
    End Sub

    Private Sub NormalImage(ByVal
 sender As Object, _
        ByVal e As EventArgs) Handles
 Button5.Click

        For Each column As
 DataGridViewImageColumn _
            In dataGridView1.Columns
            column.ImageLayout = DataGridViewImageCellLayout.Normal
            column.Description = "Normal image layout"
        Next
    End Sub

    Private Sub MakeCellsLarger(ByVal
 sender As Object, _
        ByVal e As EventArgs) Handles
 Button2.Click

        For Each column As
 DataGridViewImageColumn _
            In dataGridView1.Columns
            column.Width = column.Width * 2
        Next
        For Each row As
 DataGridViewRow In dataGridView1.Rows
            If row.IsNewRow Then Continue For
            row.Height = CInt(row.Height * 1.5)
        Next
    End Sub

    Private Function IsAWin() As
 Boolean
        If ARowIsSame() OrElse AColumnIsSame()
 OrElse ADiagonalIsSame() Then
            Return True
        Else 
            Return False
        End If
    End Function

    Private Function ARowIsSame() As
 Boolean
        Dim marking As Bitmap = Nothing
        If marking Is blank Then
 Return False
        For Each row As
 DataGridViewRow In dataGridView1.Rows
            If row.IsNewRow Then Continue For
            marking = CType(row.Cells(0).Value, Bitmap)
            If Not marking Is
 blank Then
                If marking Is row.Cells(1).Value
 AndAlso _
                    marking Is row.Cells(2).Value Then
 Return True
            End If
        Next
        Return False
    End Function

    Private Function AColumnIsSame() As
 Boolean

        Dim columnIndex As Integer
 = 0
        Dim marking As Bitmap
        Do
            marking = CType(dataGridView1.Rows(0).Cells(columnIndex).Value, _
                Bitmap)
            If Not marking Is
 blank Then
                If marking Is _
                    dataGridView1.Rows(1).Cells(columnIndex).Value _
                    AndAlso marking Is _
                    dataGridView1.Rows(2).Cells(columnIndex).Value _
                    Then Return True
            End If
            columnIndex = columnIndex + 1
        Loop While columnIndex < _
            dataGridView1.Columns.GetColumnCount( _
            DataGridViewElementStates.Visible)
        Return False
    End Function

    Private Function ADiagonalIsSame() As
 Boolean

        If LeftToRightDiagonalIsSame() Then
 Return True
        If RightToLeftDiagonalIsSame() Then
 Return True
        Return False
    End Function

    Private Function LeftToRightDiagonalIsSame()
 As Boolean
        Return IsDiagonalSame(0, 2)
    End Function

    Private Function RightToLeftDiagonalIsSame()
 As Boolean
        Return IsDiagonalSame(2, 0)
    End Function

    Private Function IsDiagonalSame(ByVal
 startingColumn As Integer, _
        ByVal lastColumn As Integer)
 As Boolean

        Dim marking As Bitmap = CType( _
            dataGridView1.Rows(0).Cells(startingColumn).Value, Bitmap)
        If marking Is blank Then
 Return False
        If marking Is dataGridView1.Rows(1).Cells(1).Value
 AndAlso _
            marking Is dataGridView1.Rows(2).Cells(lastColumn).Value
 _
            Then Return True
    End Function

    Private Sub ToggleTurn()
        If turn.Text.Equals(xString) Then turn.Text
 = oString _
        Else turn.Text = xString
    End Sub

    Private Function IsOsTurn() As
 Boolean
        If turn.Text.Equals(oString) Then Return
 True _
        Else  : Return False
    End Function

    <STAThread> Public Shared Sub
 Main()
        Application.Run(New TicTacToe())
    End Sub

End Class
using System.IO;
using System.Windows.Forms;
using System.Drawing;
using System;

public class TicTacToe : System.Windows.Forms.Form
{
    public TicTacToe()
    {
        blank = new Bitmap(new MemoryStream(blankImage));
        x = new Bitmap(new MemoryStream(xImage));
        o = new Bitmap(new MemoryStream(oImage));

        this.AutoSize = true;
        SetupButtons();
        InitializeDataGridView(null, null);
    }

    private DataGridView dataGridView1;
    private Button Button1 = new Button();
    private Label turn = new Label();
    private Button Button2 = new Button();
    private Button Button3 = new Button();
    private Button Button4 = new Button();
    private Button Button5 = new Button();
    private FlowLayoutPanel Panel1 = new FlowLayoutPanel();

    #region "bitmaps"
    private byte[] oImage = new byte[] {
        0x42, 0x4D, 0xC6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x76, 
        0x0, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0xB, 0x0, 0x0, 0x0, 0xA,
        0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50,
        0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10,
        0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
        0x0, 0x80, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x80, 0x80, 0x0, 
        0x80, 0x0, 0x0, 0x0, 0x80, 0x0, 0x80, 0x0, 0x80, 0x80, 0x0, 
        0x0, 0xC0, 0xC0, 0xC0, 0x0, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0,
        0xFF, 0x0, 0x0, 0xFF, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0x0, 0xFF, 
        0x0, 0x0, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0x0, 
        0xFF, 0xFF, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0xF, 0xFF, 0xF0, 
        0x0, 0x0, 0xFF, 0x0, 0xFF, 0xF0, 0xF, 0xF0, 0x0, 0x0, 0xF0, 
        0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xF0, 0xFF, 0xFF, 
        0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xF, 0xFF, 0xFF, 0xFF, 0xFF, 
        0x0, 0x0, 0x0, 0xF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0, 0x0, 0x0, 
        0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xF0, 0xFF, 
        0xFF, 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xFF, 0x0, 0xFF, 0xF0, 
        0xF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0x0, 0xF, 0xFF, 0xF0, 0x0, 
        0x0};

    private byte[] xImage = new byte[]{
        0x42, 0x4D, 0xC6, 0x0, 0x0, 0x0, 0x0, 
        0x0, 0x0, 0x0, 0x76, 0x0, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 
        0xB, 0x0, 0x0, 0x0, 0xA, 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 
        0x0, 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
        0x0, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 
        0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x0, 0x0, 0x80, 
        0x0, 0x0, 0x0, 0x80, 0x80, 0x0, 0x80, 0x0, 0x0, 0x0, 0x80, 
        0x0, 0x80, 0x0, 0x80, 0x80, 0x0, 0x0, 0xC0, 0xC0, 0xC0, 0x0,
        0x80, 0x80, 0x80, 0x0, 0x0, 0x0, 0xFF, 0x0, 0x0, 0xFF, 0x0, 
        0x0, 0x0, 0xFF, 0xFF, 0x0, 0xFF, 0x0, 0x0, 0x0, 0xFF, 0x0, 
        0xFF, 0x0, 0xFF, 0xFF, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0x0, 
        0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xFF, 0xF, 
        0xFF, 0xFF, 0xF, 0xF0, 0x0, 0x0, 0xFF, 0xF0, 0xFF, 0xF0, 
        0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xF, 0xF, 0xFF, 0xF0, 0x0,
        0x0, 0xFF, 0xFF, 0xF, 0xF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF,
        0xF, 0xF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xF0, 0xFF, 0xF0, 
        0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xF, 0xFF, 0xFF, 0xF, 0xF0, 0x0,
        0x0, 0xF0, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xFF, 
        0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0};

    private byte[] blankImage = new byte[]
 {
        0x42, 0x4D, 0xC6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x76, 
        0x0, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0xB, 0x0, 0x0, 0x0, 0xA,
        0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50,
        0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10,
        0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
        0x0, 0x80, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x80, 0x80, 0x0, 
        0x80, 0x0, 0x0, 0x0, 0x80, 0x0, 0x80, 0x0, 0x80, 0x80, 0x0, 
        0x0, 0xC0, 0xC0, 0xC0, 0x0, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0,
        0xFF, 0x0, 0x0, 0xFF, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0x0, 0xFF, 
        0x0, 0x0, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0x0, 
        0xFF, 0xFF, 0xFF, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 
        0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 
        0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 
        0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 
        0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 
        0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 
        0xFF, 0xF0, 0x0, 0x0};
    #endregion

    private Bitmap blank;
    private Bitmap x;
    private Bitmap o;
    private string xString = "X's turn";
    private string oString = "O's turn";
    private string gameOverString = "Game
 Over";
    private int bitmapPadding = 6;

    private void InitializeDataGridView(object
 sender,
        EventArgs e)
    {
        this.Panel1.SuspendLayout();
        this.SuspendLayout();

        ConfigureForm();
        SizeGrid();
        CreateColumns();
        CreateRows();

        this.Panel1.ResumeLayout(false);
        this.ResumeLayout(false);
    }

    private void ConfigureForm()
    {
        AutoSize = true;
        turn.Size = new System.Drawing.Size(75, 34);
        turn.TextAlign = ContentAlignment.MiddleLeft;
        turn.Text = xString;

        Panel1.Location = new System.Drawing.Point(0, 8);
        Panel1.Size = new System.Drawing.Size(120, 196);
        Panel1.FlowDirection = FlowDirection.TopDown;

        ClientSize = new System.Drawing.Size(355, 200);
        Controls.Add(this.Panel1);
        Text = "TicTacToe";

        dataGridView1 = new System.Windows.Forms.DataGridView();
        dataGridView1.Location = new Point(120, 0);
        dataGridView1.AllowUserToAddRows = false;
        dataGridView1.CellClick += new
            DataGridViewCellEventHandler(dataGridView1_CellClick);
        dataGridView1.CellMouseEnter += new
            DataGridViewCellEventHandler(dataGridView1_CellMouseEnter);
        dataGridView1.CellMouseLeave += new
            DataGridViewCellEventHandler(dataGridView1_CellMouseLeave);

        Controls.Add(dataGridView1);
    }

    private void SetupButtons()
    {
        Button1.AutoSize = true;
        SetupButton(Button1, "Restart", new EventHandler(Reset));
        Panel1.Controls.Add(turn);
        SetupButton(Button2, "Increase Cell Size", new
 EventHandler(MakeCellsLarger));
        SetupButton(Button3, "Stretch Images", new EventHandler(Stretch));
        SetupButton(Button4, "Zoom Images", new EventHandler(ZoomToImage));
        SetupButton(Button5, "Normal Images", new EventHandler(NormalImage));
    }

    private void SetupButton(Button button,
 string buttonLabel, EventHandler handler)
    {
        Panel1.Controls.Add(button);
        button.Text = buttonLabel;
        button.AutoSize = true;
        button.Click += handler;
    }

    private void CreateColumns()
    {
        DataGridViewImageColumn imageColumn;
        int columnCount = 0;
        do
        {
            Bitmap unMarked = blank;
            imageColumn = new DataGridViewImageColumn();

            //Add twice the padding for the left and 
            //right sides of the cell.
            imageColumn.Width = x.Width + 2 * bitmapPadding + 1;

            imageColumn.Image = unMarked;
            dataGridView1.Columns.Add(imageColumn);
            columnCount = columnCount + 1;
        }
        while (columnCount < 3);
    }

    private void CreateRows()
    {
        dataGridView1.Rows.Add();
        dataGridView1.Rows.Add();
        dataGridView1.Rows.Add();
    }

    private void SizeGrid()
    {
        dataGridView1.ColumnHeadersVisible = false;
        dataGridView1.RowHeadersVisible = false;
        dataGridView1.AllowUserToResizeColumns = false;;
        dataGridView1.AllowUserToResizeRows = false;
        dataGridView1.BorderStyle = BorderStyle.None;

        //Add twice the padding for the top of the cell 
        //and the bottom.
        dataGridView1.RowTemplate.Height = x.Height +
            2 * bitmapPadding + 1;

        dataGridView1.AutoSize = true;
    }

    private void Reset(object sender, System.EventArgs
 e)
    {
        dataGridView1.Dispose();
        InitializeDataGridView(null, null);
    }

    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 void dataGridView1_CellMouseEnter(object
 sender,
        DataGridViewCellEventArgs e)
    {
        Bitmap markingUnderMouse = (Bitmap)dataGridView1.
               Rows[e.RowIndex].
               Cells[e.ColumnIndex].Value;

        if (markingUnderMouse == blank)
        {
            dataGridView1.Cursor = Cursors.Default;
        }
        else if (markingUnderMouse == o ||
 markingUnderMouse == x)
        {
            dataGridView1.Cursor = Cursors.No;
            ToolTip(e, true);
        }
    }

    private void ToolTip(DataGridViewCellEventArgs
 e, bool showTip)
    {
        DataGridViewImageCell cell = (DataGridViewImageCell)
            dataGridView1
            .Rows[e.RowIndex].Cells[e.ColumnIndex];
        DataGridViewImageColumn imageColumn =
            (DataGridViewImageColumn)
            dataGridView1.Columns[cell.ColumnIndex];

        if (showTip) cell.ToolTipText = imageColumn.Description;
        else { cell.ToolTipText = String.Empty; }
    }

    private void dataGridView1_CellMouseLeave(object
 sender,
        DataGridViewCellEventArgs e)
    {
        ToolTip(e, false);
        dataGridView1.Cursor = Cursors.Default;
    }

    private void Stretch(object sender, EventArgs
 e)
    {
        foreach (DataGridViewImageColumn column in
            dataGridView1.Columns)
        {
            column.ImageLayout = DataGridViewImageCellLayout.Stretch;
            column.Description = "Stretched";
        }
    }

    private void ZoomToImage(object sender,
 EventArgs e)
    {

        foreach (DataGridViewImageColumn column in
            dataGridView1.Columns)
        {
            column.ImageLayout = DataGridViewImageCellLayout.Zoom;
            column.Description = "Zoomed";
        }
    }

    private void NormalImage(object sender,
 EventArgs e)
    {

        foreach (DataGridViewImageColumn column in
            dataGridView1.Columns)
        {
            column.ImageLayout = DataGridViewImageCellLayout.Normal;
            column.Description = "Normal";
        }
    }

    private void MakeCellsLarger(object sender,
 EventArgs e)
    {
        foreach (DataGridViewImageColumn column in
            dataGridView1.Columns)
        {
            column.Width = column.Width * 2;
        }
        foreach (DataGridViewRow row in dataGridView1.Rows)
        {
            if (row.IsNewRow) break;
            row.Height = (int)(row.Height * 1.5);
        }
    }

    private bool IsAWin()
    {
        if (ARowIsSame() || AColumnIsSame() || ADiagonalIsSame())
            return true;
        else return false;
    }

    private bool ARowIsSame()
    {
        Bitmap marking = null;

        foreach (DataGridViewRow row in dataGridView1.Rows)
        {
            if (row.IsNewRow) break;
            marking = (Bitmap)row.Cells[0].Value;
            if (marking != blank)
            {
                if (marking == row.Cells[1].Value &&
                    marking == row.Cells[2].Value) return true;
            }
        }
        return false;
    }

    private bool AColumnIsSame()
    {
        int columnIndex = 0;
        Bitmap marking;
        do
        {
            marking = (Bitmap)
                dataGridView1.Rows[0].Cells[columnIndex].Value;
            if (marking != blank)
            {
                if (marking == (Bitmap)dataGridView1.Rows[1]
                    .Cells[columnIndex].Value
                    && marking == (Bitmap)dataGridView1.Rows[2].
                    Cells[columnIndex].Value) return true;
            }
            columnIndex = columnIndex + 1;
        }
        while (columnIndex < dataGridView1.Columns.GetColumnCount(
            DataGridViewElementStates.Visible));
        return false;
    }

    private bool ADiagonalIsSame()
    {
        if (LeftToRightDiagonalIsSame()) { return
 true; }
        if (RightToLeftDiagonalIsSame()) { return
 true; }
        return false;
    }

    private bool LeftToRightDiagonalIsSame()
    {
        return IsDiagonalSame(0, 2);
    }

    private bool RightToLeftDiagonalIsSame()
    {
        return IsDiagonalSame(2, 0);
    }

    private bool IsDiagonalSame(int
 startingColumn, int lastColumn)
    {
        Bitmap marking = (Bitmap)dataGridView1.Rows[0]
            .Cells[startingColumn].Value;

        if (marking == blank) return false;
        if (marking == dataGridView1.Rows[1].Cells[1]
            .Value && marking == dataGridView1.Rows[2]
            .Cells[lastColumn].Value) return true;

        return false;
    }

    private void ToggleTurn()
    {
        if (turn.Text.Equals(xString)) { turn.Text = oString;
 }
        else { turn.Text = xString; }
    }

    private bool IsOsTurn()
    {
        if (turn.Text.Equals(oString)) return
 true;
        return false;
    }

    [STAThread]
    public static void Main()
    {
        Application.Run(new TicTacToe());
    }

}
継承階層継承階層
System.Object
   System.Windows.Forms.DataGridViewElement
     System.Windows.Forms.DataGridViewBand
       System.Windows.Forms.DataGridViewColumn
        System.Windows.Forms.DataGridViewImageColumn
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewImageColumn メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewColumn クラス
DataGridViewRow
DataGridViewImageCell クラス
DataGridViewImageCell.ValueIsIcon
Image
Icon
DataGridViewColumn.SortMode プロパティ

DataGridViewImageColumn コンストラクタ ()

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

DataGridViewImageColumn クラス新しインスタンス初期化しセル値を Image 型にして使用するよう構成します

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

Dim instance As New DataGridViewImageColumn
public DataGridViewImageColumn ()
public:
DataGridViewImageColumn ()
public DataGridViewImageColumn ()
public function DataGridViewImageColumn ()
解説解説

このコンストラクタは、valuesAreIcons パラメータの値を false設定して DataGridViewImageColumn(Boolean) を呼び出します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewImageColumn クラス
DataGridViewImageColumn メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewImageCell クラス
Image

DataGridViewImageColumn コンストラクタ (Boolean)

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

DataGridViewImageColumn クラス新しインスタンス初期化しオプションセル値を Icon にして使用するよう構成します

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

Public Sub New ( _
    valuesAreIcons As Boolean _
)
Dim valuesAreIcons As Boolean

Dim instance As New DataGridViewImageColumn(valuesAreIcons)
public DataGridViewImageColumn (
    bool valuesAreIcons
)
public:
DataGridViewImageColumn (
    bool valuesAreIcons
)
public DataGridViewImageColumn (
    boolean valuesAreIcons
)
public function DataGridViewImageColumn (
    valuesAreIcons : boolean
)

パラメータ

valuesAreIcons

この列に含まれるセルValue プロパティIcon 型の値に設定されることを示す場合trueImage 型の値に設定されることを示す場合false

解説解説

このコンストラクタは、次のプロパティ設定することによって列を初期化します。

プロパティ

CellTemplate

ValueIsIcon プロパティvaluesAreIcons パラメータの値に初期化された新しい DataGridViewImageCell。

ValuesAreIcons

valuesAreIcons パラメータの値。

DefaultCellStyle プロパティによって返される DataGridViewCellStyle オブジェクトAlignment プロパティ

DataGridViewContentAlignment.MiddleCenter

DefaultCellStyle プロパティによって返される DataGridViewCellStyle オブジェクトの NullValue プロパティ

valuesAreIconstrue場合は、Icon 型の標準エラー グラフィックvaluesAreIconsfalse場合は、Bitmap 型の標準エラー グラフィック

Icon 型のセル値のアルファ チャネル正確に描画されるようにするには、このコンストラクタvaluesAreIcons パラメータ値を true設定して使用します

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewImageColumn クラス
DataGridViewImageColumn メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewCell.Value プロパティ
ValuesAreIcons
CellTemplate
DataGridViewImageCell クラス
DataGridViewImageCell.ValueIsIcon
DefaultCellStyle
DataGridViewCellStyle クラス
DataGridViewCellStyle.Alignment プロパティ
DataGridViewCellStyle.NullValue プロパティ
Icon
Bitmap
Image

DataGridViewImageColumn コンストラクタ

DataGridViewImageColumn クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
DataGridViewImageColumn () DataGridViewImageColumn クラス新しインスタンス初期化しセル値を Image 型にして使用するよう構成します
DataGridViewImageColumn (Boolean) DataGridViewImageColumn クラス新しインスタンス初期化しオプションセル値を Icon にして使用するよう構成します
参照参照

関連項目

DataGridViewImageColumn クラス
DataGridViewImageColumn メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewImageCell クラス
Image

DataGridViewImageColumn プロパティ


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

( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ AutoSizeMode  列の幅を自動的に調整するときに使用するモード取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ CellTemplate オーバーライドされます新しセル作成使用するテンプレート取得または設定します
パブリック プロパティ CellType  セル テンプレートランタイム型を取得します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ ContextMenuStrip  列のショートカット メニュー取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ DataGridView  この要素関連付けられている DataGridView コントロール取得します。 ( DataGridViewElement から継承されます。)
パブリック プロパティ DataPropertyName  DataGridViewColumn がバインドされている、データ ソース プロパティの名前またはデータベースの列の名前を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ DefaultCellStyle オーバーライドされます。 列の既定セル スタイル取得または設定します
パブリック プロパティ DefaultHeaderCellType  既定ヘッダー セルランタイム型を取得または設定します。 ( DataGridViewBand から継承されます。)
パブリック プロパティ Description 列のイメージ説明する文字列取得または設定します
パブリック プロパティ Displayed  バンドが現在画面表示されているかどうかを示す値を取得します。 ( DataGridViewBand から継承されます。)
パブリック プロパティ DisplayIndex  現在表示されている列を基準とした列の表示順序設定または取得します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ DividerWidth  列の区分線の幅 (ピクセル数) を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ FillWeight  列が、コントロール内の他の塗りつぶしモードの列の幅を基準とする塗りつぶしモード場合、列の幅を表す値を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Frozen  ユーザーDataGridView コントロール平方向にスクロールしたときに列が移動するかどうかを示す値を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ HasDefaultCellStyle  DefaultCellStyle プロパティ設定されているかどうかを示す値を取得します。 ( DataGridViewBand から継承されます。)
パブリック プロパティ HeaderCell  ヘッダーを表す DataGridViewColumnHeaderCell を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ HeaderText  列のヘッダー セルキャプション テキスト取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Icon セルValue プロパティ設定されておらず、セルの ValueIsIcon プロパティtrue設定されている場合に、この列のセル表示されるアイコン取得または設定します
パブリック プロパティ Image セルValue プロパティ設定されておらず、セルValueIsIcon プロパティfalse設定されている場合に、この列のセル表示されるイメージ取得または設定します
パブリック プロパティ ImageLayout この列のセルイメージレイアウト取得または設定します
パブリック プロパティ Index  DataGridView コントロール内のバンド相対位置取得します。 ( DataGridViewBand から継承されます。)
パブリック プロパティ InheritedAutoSizeMode  に対して有効なサイズ変更モード取得します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ InheritedStyle  列に現在適用されているセル スタイル取得します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ IsDataBound  列がデータ ソースバインドされているかどうかを示す値を取得します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ MinimumWidth  列の最小幅をピクセル単位取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Name  列の名前を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ ReadOnly  ユーザーが列のセル編集できるかどうかを示す値を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Resizable  列のサイズ変更できるかどうかを示す値を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Selected  バンドが、選択されユーザー インターフェイス (UI) 状態かどうかを示す値を取得または設定します。 ( DataGridViewBand から継承されます。)
パブリック プロパティ Site  列のサイト取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ SortMode  列の並べ替えモード取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ State  要素ユーザー インターフェイス (UI) の状態を取得します。 ( DataGridViewElement から継承されます。)
パブリック プロパティ Tag  バンド関連付けられているデータを含むオブジェクト取得または設定します。 ( DataGridViewBand から継承されます。)
パブリック プロパティ ToolTipText  ツールヒント使用されるテキスト取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ ValuesAreIcons この列に含まれるセルIcon 値を表示するかどうかを示す値を取得または設定します
パブリック プロパティ ValueType  列のセルの値のデータ型取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Visible  列を表示するかどうかを示す値を取得または設定します。 ( DataGridViewColumn から継承されます。)
パブリック プロパティ Width  列の現在の幅を取得または設定します。 ( DataGridViewColumn から継承されます。)
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HeaderCellCore  DataGridViewBand のヘッダー セル取得または設定します。 ( DataGridViewBand から継承されます。)
プロテクト プロパティ IsRow  バンドが行を表すかどうかを示す値を取得します。 ( DataGridViewBand から継承されます。)
参照参照

関連項目

DataGridViewImageColumn クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewColumn クラス
DataGridViewRow
DataGridViewImageCell クラス
DataGridViewImageCell.ValueIsIcon
Image
Icon
DataGridViewColumn.SortMode プロパティ

DataGridViewImageColumn メソッド


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

プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Dispose  オーバーロードされますDataGridViewColumn によって使用されているすべてのリソース解放します。 ( DataGridViewColumn から継承されます。)
プロテクト メソッド Finalize  バンド関連付けられたリソース解放します。 ( DataGridViewBand から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object簡易コピー作成します。 ( Object から継承されます。)
プロテクト メソッド OnDataGridViewChanged  バンド別の DataGridView に関連付けられている場合呼び出されます。 ( DataGridViewBand から継承されます。)
プロテクト メソッド RaiseCellClick  DataGridView.CellClick イベント発生させます。 ( DataGridViewElement から継承されます。)
プロテクト メソッド RaiseCellContentClick  DataGridView.CellContentClick イベント発生させます。 ( DataGridViewElement から継承されます。)
プロテクト メソッド RaiseCellContentDoubleClick  DataGridView.CellContentDoubleClick イベント発生させます。 ( DataGridViewElement から継承されます。)
プロテクト メソッド RaiseCellValueChanged  DataGridView.CellValueChanged イベント発生させます。 ( DataGridViewElement から継承されます。)
プロテクト メソッド RaiseDataError  DataGridView.DataError イベント発生させます。 ( DataGridViewElement から継承されます。)
プロテクト メソッド RaiseMouseWheel  Control.MouseWheel イベント発生させます。 ( DataGridViewElement から継承されます。)
参照参照

関連項目

DataGridViewImageColumn クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewColumn クラス
DataGridViewRow
DataGridViewImageCell クラス
DataGridViewImageCell.ValueIsIcon
Image
Icon
DataGridViewColumn.SortMode プロパティ

DataGridViewImageColumn メンバ

DataGridViewImageCell オブジェクトコレクションホストます。

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DataGridViewImageColumn オーバーロードされます。 DataGridViewImageColumn クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ AutoSizeMode  列の幅を自動的に調整するときに使用するモード取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ CellTemplate オーバーライドされます新しセル作成使用するテンプレート取得または設定します
パブリック プロパティ CellType  セル テンプレートランタイム型を取得します。(DataGridViewColumn から継承されます。)
パブリック プロパティ ContextMenuStrip  列のショートカット メニュー取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ DataGridView  この要素関連付けられている DataGridView コントロール取得します。(DataGridViewElement から継承されます。)
パブリック プロパティ DataPropertyName  DataGridViewColumnバインドされている、データ ソース プロパティの名前またはデータベースの列の名前を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ DefaultCellStyle オーバーライドされます。 列の既定セル スタイル取得または設定します
パブリック プロパティ DefaultHeaderCellType  既定ヘッダー セルランタイム型を取得または設定します。(DataGridViewBand から継承されます。)
パブリック プロパティ Description 列のイメージ説明する文字列取得または設定します
パブリック プロパティ Displayed  バンドが現在画面表示されているかどうかを示す値を取得します。 (DataGridViewBand から継承されます。)
パブリック プロパティ DisplayIndex  現在表示されている列を基準とした列の表示順序設定または取得します。(DataGridViewColumn から継承されます。)
パブリック プロパティ DividerWidth  列の区分線の幅 (ピクセル数) を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ FillWeight  列が、コントロール内の他の塗りつぶしモードの列の幅を基準とする塗りつぶしモード場合、列の幅を表す値を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Frozen  ユーザーDataGridView コントロール平方向にスクロールしたときに列が移動するかどうかを示す値を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ HasDefaultCellStyle  DefaultCellStyle プロパティ設定されているかどうかを示す値を取得します。 (DataGridViewBand から継承されます。)
パブリック プロパティ HeaderCell  ヘッダーを表す DataGridViewColumnHeaderCell を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ HeaderText  列のヘッダー セルキャプション テキスト取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Icon セルValue プロパティ設定されておらず、セルの ValueIsIcon プロパティtrue設定されている場合に、この列のセル表示されるアイコン取得または設定します
パブリック プロパティ Image セルValue プロパティ設定されておらず、セルValueIsIcon プロパティfalse設定されている場合に、この列のセル表示されるイメージ取得または設定します
パブリック プロパティ ImageLayout この列のセルイメージレイアウト取得または設定します
パブリック プロパティ Index  DataGridView コントロール内のバンド相対位置取得します。(DataGridViewBand から継承されます。)
パブリック プロパティ InheritedAutoSizeMode  に対して有効なサイズ変更モード取得します。(DataGridViewColumn から継承されます。)
パブリック プロパティ InheritedStyle  列に現在適用されているセル スタイル取得します。(DataGridViewColumn から継承されます。)
パブリック プロパティ IsDataBound  列がデータ ソースバインドされているかどうかを示す値を取得します。(DataGridViewColumn から継承されます。)
パブリック プロパティ MinimumWidth  列の最小幅をピクセル単位取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Name  列の名前を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ ReadOnly  ユーザーが列のセル編集できるかどうかを示す値を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Resizable  列のサイズ変更できるかどうかを示す値を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Selected  バンドが、選択されユーザー インターフェイス (UI) 状態かどうかを示す値を取得または設定します。(DataGridViewBand から継承されます。)
パブリック プロパティ Site  列のサイト取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ SortMode  列の並べ替えモード取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ State  要素ユーザー インターフェイス (UI) の状態を取得します。(DataGridViewElement から継承されます。)
パブリック プロパティ Tag  バンド関連付けられているデータを含むオブジェクト取得または設定します。(DataGridViewBand から継承されます。)
パブリック プロパティ ToolTipText  ツールヒント使用されるテキスト取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ ValuesAreIcons この列に含まれるセルIcon 値を表示するかどうかを示す値を取得または設定します
パブリック プロパティ ValueType  列のセルの値のデータ型取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Visible  列を表示するかどうかを示す値を取得または設定します。(DataGridViewColumn から継承されます。)
パブリック プロパティ Width  列の現在の幅を取得または設定します。(DataGridViewColumn から継承されます。)
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HeaderCellCore  DataGridViewBand のヘッダー セル取得または設定します。(DataGridViewBand から継承されます。)
プロテクト プロパティ IsRow  バンドが行を表すかどうかを示す値を取得します。(DataGridViewBand から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Dispose  オーバーロードされますDataGridViewColumn によって使用されているすべてのリソース解放します。 (DataGridViewColumn から継承されます。)
プロテクト メソッド Finalize  バンド関連付けられたリソース解放します。 (DataGridViewBand から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object簡易コピー作成します。 (Object から継承されます。)
プロテクト メソッド OnDataGridViewChanged  バンド別の DataGridView関連付けられている場合呼び出されます。 (DataGridViewBand から継承されます。)
プロテクト メソッド RaiseCellClick  DataGridView.CellClick イベント発生させます。 (DataGridViewElement から継承されます。)
プロテクト メソッド RaiseCellContentClick  DataGridView.CellContentClick イベント発生させます。 (DataGridViewElement から継承されます。)
プロテクト メソッド RaiseCellContentDoubleClick  DataGridView.CellContentDoubleClick イベント発生させます。 (DataGridViewElement から継承されます。)
プロテクト メソッド RaiseCellValueChanged  DataGridView.CellValueChanged イベント発生させます。 (DataGridViewElement から継承されます。)
プロテクト メソッド RaiseDataError  DataGridView.DataError イベント発生させます。 (DataGridViewElement から継承されます。)
プロテクト メソッド RaiseMouseWheel  Control.MouseWheel イベント発生させます。 (DataGridViewElement から継承されます。)
パブリック イベントパブリック イベント
  名前 説明
パブリック イベント Disposed  DataGridViewColumn が破棄されたときに発生します。(DataGridViewColumn から継承されます。)
参照参照

関連項目

DataGridViewImageColumn クラス
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewColumn クラス
DataGridViewRow
DataGridViewImageCell クラス
DataGridViewImageCell.ValueIsIcon
Image
Icon
DataGridViewColumn.SortMode プロパティ



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

辞書ショートカット

すべての辞書の索引

「DataGridViewImageColumn」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS