DataGrid クラス

定義

スクロールできるグリッドに ADO.NET データを表示します。

このクラスは .NET Core 3.1 以降のバージョンでは利用できません。 代わりに コントロールを DataGridView 使用します。このコントロールは、コントロールを置き換えて拡張します DataGrid

public ref class DataGrid : System::Windows::Forms::Control, System::ComponentModel::ISupportInitialize, System::Windows::Forms::IDataGridEditingService
public class DataGrid : System.Windows.Forms.Control, System.ComponentModel.ISupportInitialize, System.Windows.Forms.IDataGridEditingService
[System.ComponentModel.ComplexBindingProperties("DataSource", "DataMember")]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
public class DataGrid : System.Windows.Forms.Control, System.ComponentModel.ISupportInitialize, System.Windows.Forms.IDataGridEditingService
type DataGrid = class
    inherit Control
    interface ISupportInitialize
    interface IDataGridEditingService
[<System.ComponentModel.ComplexBindingProperties("DataSource", "DataMember")>]
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type DataGrid = class
    inherit Control
    interface ISupportInitialize
    interface IDataGridEditingService
Public Class DataGrid
Inherits Control
Implements IDataGridEditingService, ISupportInitialize
継承
属性
実装

次のコード例では、2 つのオブジェクトを含む Windows フォーム と DataSet 、2 つの DataTable テーブルを関連付ける を DataRelation 作成します。 データを表示するには、 メソッドをSystem.Windows.Forms.DataGrid介して SetDataBinding コントロールが にDataSetバインドされます。 フォーム上のボタンは、2 つの DataGridTableStyle オブジェクトを作成し、各オブジェクトの を MappingName いずれかのオブジェクトの に TableName 設定することで、グリッドの外観を DataTable 変更します。 この例には、 メソッドを MouseUp 使用 HitTest して、クリックされたグリッドの列、行、および一部を出力する イベントのコードも含まれています。

#using <system.dll>
#using <system.data.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>
#using <system.xml.dll>

using namespace System;
using namespace System::ComponentModel;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Windows::Forms;

#define null 0
public ref class Form1: public System::Windows::Forms::Form
{
private:
   System::ComponentModel::Container^ components;
   Button^ button1;
   Button^ button2;
   DataGrid^ myDataGrid;
   DataSet^ myDataSet;
   bool TablesAlreadyAdded;

public:
   Form1()
   {
      // Required for Windows Form Designer support.
      InitializeComponent();

      // Call SetUp to bind the controls.
      SetUp();
   }

public:
   ~Form1()
   {
      if ( components != nullptr )
      {
         delete components;
      }
   }

private:
   void InitializeComponent()
   {
      // Create the form and its controls.
      this->components = gcnew System::ComponentModel::Container;
      this->button1 = gcnew System::Windows::Forms::Button;
      this->button2 = gcnew System::Windows::Forms::Button;
      this->myDataGrid = gcnew DataGrid;
      this->Text = "DataGrid Control Sample";
      this->ClientSize = System::Drawing::Size( 450, 330 );
      button1->Location = System::Drawing::Point( 24, 16 );
      button1->Size = System::Drawing::Size( 120, 24 );
      button1->Text = "Change Appearance";
      button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click );
      button2->Location = System::Drawing::Point( 150, 16 );
      button2->Size = System::Drawing::Size( 120, 24 );
      button2->Text = "Get Binding Manager";
      button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click );
      myDataGrid->Location = System::Drawing::Point( 24, 50 );
      myDataGrid->Size = System::Drawing::Size( 300, 200 );
      myDataGrid->CaptionText = "Microsoft DataGrid Control";
      myDataGrid->MouseUp += gcnew MouseEventHandler( this, &Form1::Grid_MouseUp );
      this->Controls->Add( button1 );
      this->Controls->Add( button2 );
      this->Controls->Add( myDataGrid );
   }

   void SetUp()
   {
      // Create a DataSet with two tables and one relation.
      MakeDataSet();

      /* Bind the DataGrid to the DataSet. The dataMember
        specifies that the Customers table should be displayed.*/
      myDataGrid->SetDataBinding( myDataSet, "Customers" );
   }

private:
   void button1_Click( Object^ sender, System::EventArgs^ e )
   {
      if ( TablesAlreadyAdded )
            return;

      AddCustomDataTableStyle();
   }

private:
   void AddCustomDataTableStyle()
   {
      DataGridTableStyle^ ts1 = gcnew DataGridTableStyle;
      ts1->MappingName = "Customers";

      // Set other properties.
      ts1->AlternatingBackColor = Color::LightGray;

      /* Add a GridColumnStyle and set its MappingName 
        to the name of a DataColumn in the DataTable. 
        Set the HeaderText and Width properties. */
      DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn;
      boolCol->MappingName = "Current";
      boolCol->HeaderText = "IsCurrent Customer";
      boolCol->Width = 150;
      ts1->GridColumnStyles->Add( boolCol );

      // Add a second column style.
      DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn;
      TextCol->MappingName = "custName";
      TextCol->HeaderText = "Customer Name";
      TextCol->Width = 250;
      ts1->GridColumnStyles->Add( TextCol );

      // Create the second table style with columns.
      DataGridTableStyle^ ts2 = gcnew DataGridTableStyle;
      ts2->MappingName = "Orders";

      // Set other properties.
      ts2->AlternatingBackColor = Color::LightBlue;

      // Create new ColumnStyle objects
      DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn;
      cOrderDate->MappingName = "OrderDate";
      cOrderDate->HeaderText = "Order Date";
      cOrderDate->Width = 100;
      ts2->GridColumnStyles->Add( cOrderDate );

      /* Use a PropertyDescriptor to create a formatted
        column. First get the PropertyDescriptorCollection
        for the data source and data member. */
      PropertyDescriptorCollection^ pcol = this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties();

      /* Create a formatted column using a PropertyDescriptor.
        The formatting character "c" specifies a currency format. */
      DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true );
      csOrderAmount->MappingName = "OrderAmount";
      csOrderAmount->HeaderText = "Total";
      csOrderAmount->Width = 100;
      ts2->GridColumnStyles->Add( csOrderAmount );

      /* Add the DataGridTableStyle instances to 
        the GridTableStylesCollection. */
      myDataGrid->TableStyles->Add( ts1 );
      myDataGrid->TableStyles->Add( ts2 );

      // Sets the TablesAlreadyAdded to true so this doesn't happen again.
      TablesAlreadyAdded = true;
   }

private:
   void button2_Click( Object^ sender, System::EventArgs^ e )
   {
      BindingManagerBase^ bmGrid;
      bmGrid = BindingContext[myDataSet, "Customers"];
      MessageBox::Show( String::Concat( "Current BindingManager Position: ", bmGrid->Position )->ToString() );
   }

private:
   void Grid_MouseUp( Object^ sender, MouseEventArgs^ e )
   {
      // Create a HitTestInfo object using the HitTest method.
      // Get the DataGrid by casting sender.
      DataGrid^ myGrid = dynamic_cast<DataGrid^>(sender);
      DataGrid::HitTestInfo ^ myHitInfo = myGrid->HitTest( e->X, e->Y );
      Console::WriteLine( myHitInfo );
      Console::WriteLine( myHitInfo->Type );
      Console::WriteLine( myHitInfo->Row );
      Console::WriteLine( myHitInfo->Column );
   }

   // Create a DataSet with two tables and populate it.
   void MakeDataSet()
   {
      // Create a DataSet.
      myDataSet = gcnew DataSet( "myDataSet" );

      // Create two DataTables.
      DataTable^ tCust = gcnew DataTable( "Customers" );
      DataTable^ tOrders = gcnew DataTable( "Orders" );

      // Create two columns, and add them to the first table.
      DataColumn^ cCustID = gcnew DataColumn( "CustID",__int32::typeid );
      DataColumn^ cCustName = gcnew DataColumn( "CustName" );
      DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid );
      tCust->Columns->Add( cCustID );
      tCust->Columns->Add( cCustName );
      tCust->Columns->Add( cCurrent );

      // Create three columns, and add them to the second table.
      DataColumn^ cID = gcnew DataColumn( "CustID",__int32::typeid );
      DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid );
      DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid );
      tOrders->Columns->Add( cOrderAmount );
      tOrders->Columns->Add( cID );
      tOrders->Columns->Add( cOrderDate );

      // Add the tables to the DataSet.
      myDataSet->Tables->Add( tCust );
      myDataSet->Tables->Add( tOrders );

      // Create a DataRelation, and add it to the DataSet.
      DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID );
      myDataSet->Relations->Add( dr );

      /* Populate the tables. For each customer and order, 
        create need two DataRow variables. */
      DataRow^ newRow1;
      DataRow^ newRow2;

      // Create three customers in the Customers Table.
      for ( int i = 1; i < 4; i++ )
      {
         newRow1 = tCust->NewRow();
         newRow1[ "custID" ] = i;
         
         // Add the row to the Customers table.
         tCust->Rows->Add( newRow1 );
      }
      tCust->Rows[ 0 ][ "custName" ] = "Customer1";
      tCust->Rows[ 1 ][ "custName" ] = "Customer2";
      tCust->Rows[ 2 ][ "custName" ] = "Customer3";

      // Give the Current column a value.
      tCust->Rows[ 0 ][ "Current" ] = true;
      tCust->Rows[ 1 ][ "Current" ] = true;
      tCust->Rows[ 2 ][ "Current" ] = false;

      // For each customer, create five rows in the Orders table.
      for ( int i = 1; i < 4; i++ )
      {
         for ( int j = 1; j < 6; j++ )
         {
            newRow2 = tOrders->NewRow();
            newRow2[ "CustID" ] = i;
            newRow2[ "orderDate" ] = DateTime(2001,i,j * 2);
            newRow2[ "OrderAmount" ] = i * 10 + j * .1;
            
            // Add the row to the Orders table.
            tOrders->Rows->Add( newRow2 );
         }
      }
   }
};

int main()
{
   Application::Run( gcnew Form1 );
}
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
   private System.ComponentModel.Container components;
   private Button button1;
   private Button button2;
   private DataGrid myDataGrid;   
   private DataSet myDataSet;
   private bool TablesAlreadyAdded;
   public Form1()
   {
      // Required for Windows Form Designer support.
      InitializeComponent();
      // Call SetUp to bind the controls.
      SetUp();
   }

   protected override void Dispose( bool disposing ){
      if( disposing ){
         if (components != null){
            components.Dispose();}
      }
      base.Dispose( disposing );
   }
   private void InitializeComponent()
   {
      // Create the form and its controls.
      this.components = new System.ComponentModel.Container();
      this.button1 = new System.Windows.Forms.Button();
      this.button2 = new System.Windows.Forms.Button();
      this.myDataGrid = new DataGrid();
      
      this.Text = "DataGrid Control Sample";
      this.ClientSize = new System.Drawing.Size(450, 330);
      
      button1.Location = new Point(24, 16);
      button1.Size = new System.Drawing.Size(120, 24);
      button1.Text = "Change Appearance";
      button1.Click+=new System.EventHandler(button1_Click);

      button2.Location = new Point(150, 16);
      button2.Size = new System.Drawing.Size(120, 24);
      button2.Text = "Get Binding Manager";
      button2.Click+=new System.EventHandler(button2_Click);

      myDataGrid.Location = new  Point(24, 50);
      myDataGrid.Size = new Size(300, 200);
      myDataGrid.CaptionText = "Microsoft DataGrid Control";
      myDataGrid.MouseUp += new MouseEventHandler(Grid_MouseUp);
      
      this.Controls.Add(button1);
      this.Controls.Add(button2);
      this.Controls.Add(myDataGrid);
   }

   public static void Main()
   {
      Application.Run(new Form1());
   }
   
   private void SetUp()
   {
      // Create a DataSet with two tables and one relation.
      MakeDataSet();
      /* Bind the DataGrid to the DataSet. The dataMember
      specifies that the Customers table should be displayed.*/
      myDataGrid.SetDataBinding(myDataSet, "Customers");
   }

   private void button1_Click(object sender, System.EventArgs e)
   {
      if(TablesAlreadyAdded) return;
      AddCustomDataTableStyle();
   }

   private void AddCustomDataTableStyle()
   {
      DataGridTableStyle ts1 = new DataGridTableStyle();
      ts1.MappingName = "Customers";
      // Set other properties.
      ts1.AlternatingBackColor = Color.LightGray;

      /* Add a GridColumnStyle and set its MappingName 
      to the name of a DataColumn in the DataTable. 
      Set the HeaderText and Width properties. */
      
      DataGridColumnStyle boolCol = new DataGridBoolColumn();
      boolCol.MappingName = "Current";
      boolCol.HeaderText = "IsCurrent Customer";
      boolCol.Width = 150;
      ts1.GridColumnStyles.Add(boolCol);
      
      // Add a second column style.
      DataGridColumnStyle TextCol = new DataGridTextBoxColumn();
      TextCol.MappingName = "custName";
      TextCol.HeaderText = "Customer Name";
      TextCol.Width = 250;
      ts1.GridColumnStyles.Add(TextCol);

      // Create the second table style with columns.
      DataGridTableStyle ts2 = new DataGridTableStyle();
      ts2.MappingName = "Orders";

      // Set other properties.
      ts2.AlternatingBackColor = Color.LightBlue;
      
      // Create new ColumnStyle objects
      DataGridColumnStyle cOrderDate = 
      new DataGridTextBoxColumn();
      cOrderDate.MappingName = "OrderDate";
      cOrderDate.HeaderText = "Order Date";
      cOrderDate.Width = 100;
      ts2.GridColumnStyles.Add(cOrderDate);

      /* Use a PropertyDescriptor to create a formatted
      column. First get the PropertyDescriptorCollection
      for the data source and data member. */
      PropertyDescriptorCollection pcol = this.BindingContext
      [myDataSet, "Customers.custToOrders"].GetItemProperties();
 
      /* Create a formatted column using a PropertyDescriptor.
      The formatting character "c" specifies a currency format. */     
      DataGridColumnStyle csOrderAmount = 
      new DataGridTextBoxColumn(pcol["OrderAmount"], "c", true);
      csOrderAmount.MappingName = "OrderAmount";
      csOrderAmount.HeaderText = "Total";
      csOrderAmount.Width = 100;
      ts2.GridColumnStyles.Add(csOrderAmount);

      /* Add the DataGridTableStyle instances to 
      the GridTableStylesCollection. */
      myDataGrid.TableStyles.Add(ts1);
      myDataGrid.TableStyles.Add(ts2);

     // Sets the TablesAlreadyAdded to true so this doesn't happen again.
     TablesAlreadyAdded=true;
   }

   private void button2_Click(object sender, System.EventArgs e)
   {
      BindingManagerBase bmGrid;
      bmGrid = BindingContext[myDataSet, "Customers"];
      MessageBox.Show("Current BindingManager Position: " + bmGrid.Position);
   }

   private void Grid_MouseUp(object sender, MouseEventArgs e)
   {
      // Create a HitTestInfo object using the HitTest method.

      // Get the DataGrid by casting sender.
      DataGrid myGrid = (DataGrid)sender;
      DataGrid.HitTestInfo myHitInfo = myGrid.HitTest(e.X, e.Y);
      Console.WriteLine(myHitInfo);
      Console.WriteLine(myHitInfo.Type);
      Console.WriteLine(myHitInfo.Row);
      Console.WriteLine(myHitInfo.Column);
   }

   // Create a DataSet with two tables and populate it.
   private void MakeDataSet()
   {
      // Create a DataSet.
      myDataSet = new DataSet("myDataSet");
      
      // Create two DataTables.
      DataTable tCust = new DataTable("Customers");
      DataTable tOrders = new DataTable("Orders");

      // Create two columns, and add them to the first table.
      DataColumn cCustID = new DataColumn("CustID", typeof(int));
      DataColumn cCustName = new DataColumn("CustName");
      DataColumn cCurrent = new DataColumn("Current", typeof(bool));
      tCust.Columns.Add(cCustID);
      tCust.Columns.Add(cCustName);
      tCust.Columns.Add(cCurrent);

      // Create three columns, and add them to the second table.
      DataColumn cID = 
      new DataColumn("CustID", typeof(int));
      DataColumn cOrderDate = 
      new DataColumn("orderDate",typeof(DateTime));
      DataColumn cOrderAmount = 
      new DataColumn("OrderAmount", typeof(decimal));
      tOrders.Columns.Add(cOrderAmount);
      tOrders.Columns.Add(cID);
      tOrders.Columns.Add(cOrderDate);

      // Add the tables to the DataSet.
      myDataSet.Tables.Add(tCust);
      myDataSet.Tables.Add(tOrders);

      // Create a DataRelation, and add it to the DataSet.
      DataRelation dr = new DataRelation
      ("custToOrders", cCustID , cID);
      myDataSet.Relations.Add(dr);
   
      /* Populates the tables. For each customer and order, 
      creates two DataRow variables. */
      DataRow newRow1;
      DataRow newRow2;

      // Create three customers in the Customers Table.
      for(int i = 1; i < 4; i++)
      {
         newRow1 = tCust.NewRow();
         newRow1["custID"] = i;
         // Add the row to the Customers table.
         tCust.Rows.Add(newRow1);
      }
      // Give each customer a distinct name.
      tCust.Rows[0]["custName"] = "Customer1";
      tCust.Rows[1]["custName"] = "Customer2";
      tCust.Rows[2]["custName"] = "Customer3";

      // Give the Current column a value.
      tCust.Rows[0]["Current"] = true;
      tCust.Rows[1]["Current"] = true;
      tCust.Rows[2]["Current"] = false;

      // For each customer, create five rows in the Orders table.
      for(int i = 1; i < 4; i++)
      {
         for(int j = 1; j < 6; j++)
         {
            newRow2 = tOrders.NewRow();
            newRow2["CustID"]= i;
            newRow2["orderDate"]= new DateTime(2001, i, j * 2);
            newRow2["OrderAmount"] = i * 10 + j  * .1;
            // Add the row to the Orders table.
            tOrders.Rows.Add(newRow2);
         }
      }
   }
}
Option Explicit
Option Strict

Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1
   Inherits System.Windows.Forms.Form
   Private components As System.ComponentModel.Container
   Private button1 As Button
   Private button2 As Button
   Private myDataGrid As DataGrid
   Private myDataSet As DataSet
   Private TablesAlreadyAdded As Boolean    
    
   Public Sub New()
      ' Required for Windows Form Designer support.
      InitializeComponent()
      ' Call SetUp to bind the controls.
      SetUp()
   End Sub 
        
  Private Sub InitializeComponent()
      ' Create the form and its controls.
      Me.components = New System.ComponentModel.Container()
      Me.button1 = New System.Windows.Forms.Button()
      Me.button2 = New System.Windows.Forms.Button()
      Me.myDataGrid = New DataGrid()
      
      Me.Text = "DataGrid Control Sample"
      Me.ClientSize = New System.Drawing.Size(450, 330)
        
      button1.Location = New Point(24, 16)
      button1.Size = New System.Drawing.Size(120, 24)
      button1.Text = "Change Appearance"
      AddHandler button1.Click, AddressOf button1_Click
        
      button2.Location = New Point(150, 16)
      button2.Size = New System.Drawing.Size(120, 24)
      button2.Text = "Get Binding Manager"
      AddHandler button2.Click, AddressOf button2_Click
        
      myDataGrid.Location = New Point(24, 50)
      myDataGrid.Size = New Size(300, 200)
      myDataGrid.CaptionText = "Microsoft DataGrid Control"
      AddHandler myDataGrid.MouseUp, AddressOf Grid_MouseUp
        
      Me.Controls.Add(button1)
      Me.Controls.Add(button2)
      Me.Controls.Add(myDataGrid)
   End Sub 
    
   Public Shared Sub Main()
      Application.Run(New Form1())
   End Sub 
        
   Private Sub SetUp()
      ' Create a DataSet with two tables and one relation.
      MakeDataSet()
      ' Bind the DataGrid to the DataSet. The dataMember
      ' specifies that the Customers table should be displayed.
      myDataGrid.SetDataBinding(myDataSet, "Customers")
   End Sub 
        
    Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        If TablesAlreadyAdded = True Then Exit Sub
        AddCustomDataTableStyle()
    End Sub
   
   Private Sub AddCustomDataTableStyle()
      Dim ts1 As New DataGridTableStyle()
      ts1.MappingName = "Customers"
      ' Set other properties.
      ts1.AlternatingBackColor = Color.LightGray
      ' Add a GridColumnStyle and set its MappingName 
      ' to the name of a DataColumn in the DataTable. 
      ' Set the HeaderText and Width properties. 
        
      Dim boolCol As New DataGridBoolColumn()
      boolCol.MappingName = "Current"
      boolCol.HeaderText = "IsCurrent Customer"
      boolCol.Width = 150
      ts1.GridColumnStyles.Add(boolCol)
        
      ' Add a second column style.
      Dim TextCol As New DataGridTextBoxColumn()
      TextCol.MappingName = "custName"
      TextCol.HeaderText = "Customer Name"
      TextCol.Width = 250
      ts1.GridColumnStyles.Add(TextCol)
        
      ' Create the second table style with columns.
      Dim ts2 As New DataGridTableStyle()
      ts2.MappingName = "Orders"
        
      ' Set other properties.
      ts2.AlternatingBackColor = Color.LightBlue
        
      ' Create new ColumnStyle objects
      Dim cOrderDate As New DataGridTextBoxColumn()
      cOrderDate.MappingName = "OrderDate"
      cOrderDate.HeaderText = "Order Date"
      cOrderDate.Width = 100
      ts2.GridColumnStyles.Add(cOrderDate)

      ' Use a PropertyDescriptor to create a formatted
      ' column. First get the PropertyDescriptorCollection
      ' for the data source and data member. 
      Dim pcol As PropertyDescriptorCollection = _
      Me.BindingContext(myDataSet, "Customers.custToOrders"). _
      GetItemProperties()

      ' Create a formatted column using a PropertyDescriptor.
      ' The formatting character "c" specifies a currency format. */     
        
      Dim csOrderAmount As _
      New DataGridTextBoxColumn(pcol("OrderAmount"), "c", True)
      csOrderAmount.MappingName = "OrderAmount"
      csOrderAmount.HeaderText = "Total"
      csOrderAmount.Width = 100
      ts2.GridColumnStyles.Add(csOrderAmount)
        
      ' Add the DataGridTableStyle instances to 
      ' the GridTableStylesCollection. 
      myDataGrid.TableStyles.Add(ts1)
      myDataGrid.TableStyles.Add(ts2)

     ' Sets the TablesAlreadyAdded to true so this doesn't happen again.
      TablesAlreadyAdded = true
   End Sub 
    
    Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim bmGrid As BindingManagerBase
        bmGrid = BindingContext(myDataSet, "Customers")
        MessageBox.Show(("Current BindingManager Position: " & bmGrid.Position))
    End Sub
        
   Private Sub Grid_MouseUp(sender As Object, e As MouseEventArgs)
      ' Create a HitTestInfo object using the HitTest method.
      ' Get the DataGrid by casting sender.
      Dim myGrid As DataGrid = CType(sender, DataGrid)
      Dim myHitInfo As DataGrid.HitTestInfo = myGrid.HitTest(e.X, e.Y)
      Console.WriteLine(myHitInfo)
      Console.WriteLine(myHitInfo.Type)
      Console.WriteLine(myHitInfo.Row)
      Console.WriteLine(myHitInfo.Column)
   End Sub 
        
   ' Create a DataSet with two tables and populate it.
   Private Sub MakeDataSet()
      ' Create a DataSet.
      myDataSet = New DataSet("myDataSet")
       
      ' Create two DataTables.
      Dim tCust As New DataTable("Customers")
      Dim tOrders As New DataTable("Orders")
      
      ' Create two columns, and add them to the first table.
      Dim cCustID As New DataColumn("CustID", GetType(Integer))
      Dim cCustName As New DataColumn("CustName")
      Dim cCurrent As New DataColumn("Current", GetType(Boolean))
      tCust.Columns.Add(cCustID)
      tCust.Columns.Add(cCustName)
      tCust.Columns.Add(cCurrent)
       
      ' Create three columns, and add them to the second table.
      Dim cID As New DataColumn("CustID", GetType(Integer))
      Dim cOrderDate As New DataColumn("orderDate", GetType(DateTime))
      Dim cOrderAmount As New DataColumn("OrderAmount", GetType(Decimal))
      tOrders.Columns.Add(cOrderAmount)
      tOrders.Columns.Add(cID)
      tOrders.Columns.Add(cOrderDate)
       
      ' Add the tables to the DataSet.
      myDataSet.Tables.Add(tCust)
      myDataSet.Tables.Add(tOrders)
        
      ' Create a DataRelation, and add it to the DataSet.
      Dim dr As New DataRelation("custToOrders", cCustID, cID)
      myDataSet.Relations.Add(dr)
        
      ' Populates the tables. For each customer and order, 
      ' creates two DataRow variables. 
      Dim newRow1 As DataRow
      Dim newRow2 As DataRow
        
      ' Create three customers in the Customers Table.
      Dim i As Integer
      For i = 1 To 3
         newRow1 = tCust.NewRow()
         newRow1("custID") = i
         ' Add the row to the Customers table.
         tCust.Rows.Add(newRow1)
      Next i
      ' Give each customer a distinct name.
      tCust.Rows(0)("custName") = "Customer1"
      tCust.Rows(1)("custName") = "Customer2"
      tCust.Rows(2)("custName") = "Customer3"
        
      ' Give the Current column a value.
      tCust.Rows(0)("Current") = True
      tCust.Rows(1)("Current") = True
      tCust.Rows(2)("Current") = False
        
      ' For each customer, create five rows in the Orders table.
      For i = 1 To 3
         Dim j As Integer
         For j = 1 To 5
            newRow2 = tOrders.NewRow()
            newRow2("CustID") = i
            newRow2("orderDate") = New DateTime(2001, i, j * 2)
            newRow2("OrderAmount") = i * 10 + j * 0.1
            ' Add the row to the Orders table.
            tOrders.Rows.Add(newRow2)
         Next j
      Next i
   End Sub 
End Class

注釈

このクラスは .NET Core 3.1 以降のバージョンでは利用できません。 代わりに コントロールを DataGridView 使用してください。

には System.Windows.Forms.DataGrid 、子テーブルへの Web のようなリンクが表示されます。 リンクをクリックすると、子テーブルに移動できます。 子テーブルが表示されると、親テーブルに戻るためにクリックできる [戻る] ボタンがキャプションに表示されます。 親行のデータは、キャプションの下と列ヘッダーの上に表示されます。 戻るボタンの右側にあるボタンをクリックすると、親行の情報を非表示にすることができます。

実行時に にテーブルをSystem.Windows.Forms.DataGrid表示するには、 メソッドをSetDataBinding使用して、 プロパティと DataMember プロパティを有効なデータ ソースに設定DataSourceします。 次のデータ ソースが有効です。

クラスの DataSet 詳細については、「 DataSets、DataTables、DataViews」を参照してください。

ユーザーがデータを編集できるグリッドを作成できますが、 をデータ ソースとして使用DataViewし、 プロパティを に設定することで、ユーザーが新しい行をAllowNewfalse追加できないようにすることができます。

データ ソースは、オブジェクトによって BindingManagerBase さらに管理されます。 データ ソース内の各テーブルについて、 BindingManagerBase フォームの BindingContextから を返すことができます。 たとえば、関連付けられている BindingManagerBase オブジェクトの プロパティを返すことで、データ ソースに含まれる行の Count 数を確認できます。

データを検証するには、データとそのイベントを表す基になるオブジェクトを使用します。 たとえば、 内の からDataTableDataSetデータが取得される場合は、 イベントと RowChanging イベントを使用しますColumnChanging

注意

列の数は (のメンバーGridColumnStylesCollectionを追加または削除することによって) カスタマイズでき、行は列で並べ替えることができるため、 RowNumber および ColumnNumber プロパティの値が 内DataTableの および DataColumn インデックスにDataRow対応することを保証することはできません。 そのため、イベントでこれらのプロパティを使用してデータを Validating 検証しないようにする必要があります。

選択されているセルを確認するには、 プロパティを CurrentCell 使用します。 プロパティを使用して任意のセルの値を Item[] 変更します。このプロパティは、セルの行インデックスと列インデックス、または 1 つの DataGridCellを受け取ることができます。 イベントを CurrentCellChanged 監視して、ユーザーが別のセルを選択したときに検出します。

ユーザーがクリックしたコントロールのどの部分を確認するには、 イベントで メソッドをMouseDown使用HitTestします。 メソッドは HitTest 、クリックされた領域の行と列を含む オブジェクトを返 DataGrid.HitTestInfo します。

実行時にコントロールの外観を管理するために、色とキャプション属性を設定するためのいくつかのプロパティ (、 などCaptionForeColorCaptionBackColorCaptionFont) を使用できます。

表示されるグリッド (またはグリッド) の外観をさらに変更するには、オブジェクトをDataGridTableStyle作成し、 プロパティを介してTableStylesアクセスされる にGridTableStylesCollection追加します。 たとえば、 が 3 つのDataTableオブジェクトをDataSet含む に設定されている場合DataSourceは、コレクションに 3 つのDataGridTableStyleオブジェクト (テーブルごとに 1 つ) を追加できます。 各 DataGridTableStyle オブジェクトを DataTableと同期するには、 の DataGridTableStyleMappingName の にTableName設定しますDataTable。 オブジェクトの配列へのバインドの詳細については、 プロパティを DataGridTableStyle.MappingName 参照してください。

テーブルのカスタマイズされたビューを作成するには、 クラスまたは クラスのDataGridTextBoxColumnインスタンスを作成し、 プロパティを介してアクセスされる に GridTableStylesCollection オブジェクトをTableStyles追加DataGridBoolColumnします。 これらのクラスは、どちらも DataGridColumnStyle を継承しています。 列のスタイルごとに、 をグリッドにColumnName表示する列の の に設定MappingNameします。 列を非表示にするには、 を MappingName 有効な ColumnName以外の値に設定します。

列のテキストの書式を設定するには、 の DataGridTextBoxColumn プロパティをFormat、「書式設定の種類」および「ユーザー設定の日付と時刻の書式指定文字列」にある値のいずれかに設定します。

をオブジェクトの DataGrid 厳密に型指定された配列にバインドするには、オブジェクト型にパブリック プロパティが含まれている必要があります。 配列を表示する を DataGridTableStyle 作成するには、 プロパティを DataGridTableStyle.MappingNametypename[] 設定します。ここで typename 、 はオブジェクト型の名前に置き換えられます。 また、 MappingName プロパティでは大文字と小文字が区別されます。型名は正確に一致する必要があります。 例については、 MappingName プロパティを参照してください。

を にArrayListバインドDataGridすることもできます。 の特徴は、複数の ArrayList 型のオブジェクトを含めることができるが、 は、リスト内のすべての項目が DataGrid 最初の項目と同じ型の場合にのみ、そのようなリストにバインドできることです。 つまり、すべてのオブジェクトが同じ型であるか、リスト内の最初の項目と同じクラスから継承する必要があります。 たとえば、リスト内の最初の項目が の場合、Control2 番目の項目は ( からControl継承される) である可能性がありますTextBox。 一方、最初の項目が の TextBox場合、2 番目のオブジェクトを に Controlすることはできません。 さらに、 には ArrayList バインド時に項目が含まれている必要があります。 空 ArrayList の場合、グリッドは空になります。 さらに、 内の オブジェクトにはパブリック プロパティが ArrayList 含まれている必要があります。 にArrayListバインドする場合は、 の DataGridTableStyleMappingName "ArrayList" (型名) に設定します。

ごとにDataGridTableStyle、コントロールの設定をオーバーライドする色とキャプション属性をSystem.Windows.Forms.DataGrid設定できます。 ただし、これらのプロパティが設定されていない場合、コントロールの設定は既定で使用されます。 次のプロパティは、プロパティによって DataGridTableStyle オーバーライドできます。

個々の列の外観をカスタマイズするには、 に オブジェクトをGridColumnStylesCollection追加DataGridColumnStyleします。このオブジェクトには、各 DataGridTableStyleの プロパティをGridColumnStyles使用してアクセスします。 各 DataGridColumnStyle を 内の とDataColumnDataTable同期するには、 を MappingNameDataColumnColumnName設定します。 を構築するときに DataGridColumnStyle、列のデータの表示方法を指定する書式設定文字列を設定することもできます。 たとえば、列で短い日付形式を使用して、テーブルに含まれる日付を表示するように指定できます。

注意事項

オブジェクトを に追加する前に、常に オブジェクトをGridColumnStylesCollection作成DataGridColumnStyleし、 GridTableStylesCollectionに追加DataGridTableStyleします。 有効なMappingName値を持つ空DataGridTableStyleの をコレクションに追加すると、DataGridColumnStyleオブジェクトが自動的に生成されます。 したがって、重複するMappingName値を持つ新しいDataGridColumnStyleオブジェクトを に追加しようとすると、例外がGridColumnStylesCollectionスローされます。

注意

DataGridView コントロールは、DataGrid コントロールに代わると共に追加の機能を提供します。ただし、DataGrid コントロールは、下位互換性を保つ目的および将来使用する目的で保持されます。 詳細については、「Windows フォームの DataGridView コントロールと DataGrid コントロールの違いについて」を参照してください。

コンストラクター

DataGrid()

DataGrid クラスの新しいインスタンスを初期化します。

プロパティ

AccessibilityObject

コントロールに割り当てられた AccessibleObject を取得します。

(継承元 Control)
AccessibleDefaultActionDescription

アクセシビリティ クライアント アプリケーションで使用されるコントロールの既定のアクションの説明を取得または設定します。

(継承元 Control)
AccessibleDescription

ユーザー補助クライアント アプリケーションによって使用される、コントロールの説明を取得または設定します。

(継承元 Control)
AccessibleName

ユーザー補助クライアント アプリケーションによって使用されるコントロールの名前を取得または設定します。

(継承元 Control)
AccessibleRole

コントロールのアクセスできる役割を取得または設定します。

(継承元 Control)
AllowDrop

ユーザーがコントロールにドラッグしたデータを、そのコントロールが受け入れることができるかどうかを示す値を取得または設定します。

(継承元 Control)
AllowNavigation

移動できるかどうかを示す値を取得または設定します。

AllowSorting

列ヘッダーをクリックしてグリッドを並べ替え直すことができるかどうかを示す値を取得または設定します。

AlternatingBackColor

グリッドの奇数行の背景色を取得または設定します。

Anchor

コントロールがバインドされるコンテナーの端を取得または設定し、親のサイズ変更時に、コントロールのサイズがどのように変化するかを決定します。

(継承元 Control)
AutoScrollOffset

ScrollControlIntoView(Control) でのこのコントロールのスクロール先を取得または設定します。

(継承元 Control)
AutoSize

このクラスでは、このプロパティは使用されません。

(継承元 Control)
BackColor

グリッドの偶数行の背景色を取得または設定します。

BackgroundColor

グリッドの行以外の領域の色を取得または設定します。

BackgroundImage

このコントロールでは、このメンバーは無効です。

BackgroundImageLayout

このコントロールでは、このメンバーは無効です。

BackgroundImageLayout

ImageLayout 列挙型で定義される背景画像のレイアウトを取得または設定します。

(継承元 Control)
BindingContext

コントロールの BindingContext を取得または設定します。

(継承元 Control)
BorderStyle

グリッドの境界線スタイルを取得または設定します。

Bottom

コントロールの下端とコンテナーのクライアント領域の上端の間の距離をピクセルで取得します。

(継承元 Control)
Bounds

クライアント以外の要素を含むコントロールの、親コントロールに対する相対的なサイズおよび位置をピクセル単位で取得または設定します。

(継承元 Control)
CanEnableIme

ImeMode プロパティをアクティブな値に設定して、IME サポートを有効にできるかどうかを示す値を取得します。

(継承元 Control)
CanFocus

コントロールがフォーカスを受け取ることができるかどうかを示す値を取得します。

(継承元 Control)
CanRaiseEvents

コントロールでイベントが発生するかどうかを決定します。

(継承元 Control)
CanSelect

コントロールを選択できるかどうかを示す値を取得します。

(継承元 Control)
CaptionBackColor

キャプション領域の背景色を取得または設定します。

CaptionFont

グリッドのキャプションのフォントを取得または設定します。

CaptionForeColor

キャプション領域の前景色を取得または設定します。

CaptionText

グリッドのウィンドウ キャプションのテキストを取得または設定します。

CaptionVisible

グリッドのキャプションを表示するかどうかを示す値を取得または設定します。

Capture

コントロールがマウスをキャプチャしたかどうかを示す値を取得または設定します。

(継承元 Control)
CausesValidation

そのコントロールが原因で、フォーカスを受け取ると検証が必要なコントロールに対して、検証が実行されるかどうかを示す値を取得または設定します。

(継承元 Control)
ClientRectangle

コントロールのクライアント領域を表す四角形を取得します。

(継承元 Control)
ClientSize

コントロールのクライアント領域の高さと幅を取得または設定します。

(継承元 Control)
ColumnHeadersVisible

テーブルの列ヘッダーを表示するかどうかを示す値を取得または設定します。

CompanyName

コントロールを含んでいるアプリケーションの会社または作成者の名前を取得します。

(継承元 Control)
Container

IContainer を含む Component を取得します。

(継承元 Component)
ContainsFocus

コントロール、またはその子コントロールの 1 つに、現在入力フォーカスがあるかどうかを示す値を取得します。

(継承元 Control)
ContextMenu

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

(継承元 Control)
ContextMenuStrip

このコントロールに関連付けられている ContextMenuStrip を取得または設定します。

(継承元 Control)
Controls

コントロール内に格納されているコントロールのコレクションを取得します。

(継承元 Control)
Created

コントロールが作成されているかどうかを示す値を取得します。

(継承元 Control)
CreateParams

コントロール ハンドルが作成されるときに必要な作成パラメーターを取得します。

(継承元 Control)
CurrentCell

フォーカスがあるセルを取得または設定します。 デザイン時には使用できません。

CurrentRowIndex

現在フォーカスがある行のインデックスを取得または設定します。

Cursor

このコントロールでは、このメンバーは無効です。

DataBindings

コントロールのデータ連結を取得します。

(継承元 Control)
DataContext

データ バインディングの目的でデータ コンテキストを取得または設定します。 これはアンビエント プロパティです。

(継承元 Control)
DataMember

DataSource コントロールでグリッドを表示するための、DataGrid 内の特定のリストを取得または設定します。

DataSource

グリッドでデータが表示される対象のデータ ソースを取得または設定します。

DefaultCursor

コントロールの既定のカーソルを取得または設定します。

(継承元 Control)
DefaultImeMode

コントロールがサポートしている既定の IME (Input Method Editor) モードを取得します。

(継承元 Control)
DefaultMargin

コントロール間に既定で指定されている空白をピクセル単位で取得します。

(継承元 Control)
DefaultMaximumSize

コントロールの既定の最大サイズとして指定されている長さおよび高さをピクセル単位で取得します。

(継承元 Control)
DefaultMinimumSize

コントロールの既定の最小サイズとして指定されている長さおよび高さをピクセル単位で取得します。

(継承元 Control)
DefaultPadding

コントロールの内容の内部間隔をピクセル単位で取得します。

(継承元 Control)
DefaultSize

コントロールの既定のサイズを取得します。

DesignMode

Component が現在デザイン モードかどうかを示す値を取得します。

(継承元 Component)
DeviceDpi

コントロールが現在表示されているディスプレイ デバイスの DPI 値を取得します。

(継承元 Control)
DisplayRectangle

コントロールの表示領域を表す四角形を取得します。

(継承元 Control)
Disposing

基本 Control クラスが破棄処理中かどうかを示す値を取得します。

(継承元 Control)
Dock

コントロールの境界のうち、親コントロールにドッキングする境界を取得または設定します。また、コントロールのサイズが親コントロール内でどのように変化するかを決定します。

(継承元 Control)
DoubleBuffered

ちらつきを軽減または回避するために、2 次バッファーを使用してコントロールの表面を再描画するかどうかを示す値を取得または設定します。

(継承元 Control)
Enabled

コントロールがユーザーとの対話に応答できるかどうかを示す値を取得または設定します。

(継承元 Control)
Events

Component に結び付けられているイベント ハンドラーのリストを取得します。

(継承元 Component)
FirstVisibleColumn

グリッドに最初に表示される列のインデックスを取得します。

FlatMode

グリッドをフラット モードで表示するかどうかを示す値を取得または設定します。

Focused

コントロールに入力フォーカスがあるかどうかを示す値を取得します。

(継承元 Control)
Font

コントロールによって表示されるテキストのフォントを取得または設定します。

(継承元 Control)
FontHeight

コントロールのフォントの高さを取得または設定します。

(継承元 Control)
ForeColor

DataGrid コントロールの前景色 (通常はテキストの色) プロパティを取得または設定します。

GridLineColor

グリッド線の色を取得または設定します。

GridLineStyle

グリッド線のスタイルを取得または設定します。

Handle

コントロールのバインド先のウィンドウ ハンドルを取得します。

(継承元 Control)
HasChildren

コントロールに 1 つ以上の子コントロールが格納されているかどうかを示す値を取得します。

(継承元 Control)
HeaderBackColor

すべての行ヘッダーおよび列ヘッダーの背景色を取得または設定します。

HeaderFont

列ヘッダーに使用するフォントを取得または設定します。

HeaderForeColor

ヘッダーの前景色を取得または設定します。

Height

コントロールの高さを取得または設定します。

(継承元 Control)
HorizScrollBar

グリッドの水平スクロール バーを取得します。

ImeMode

コントロールの IME (Input Method Editor) モードを取得または設定します。

(継承元 Control)
ImeModeBase

コントロールの IME モードを取得または設定します。

(継承元 Control)
InvokeRequired

呼び出し元がコントロールの作成されたスレッドと異なるスレッド上にあるため、コントロールに対してメソッドの呼び出しを実行するときに、呼び出し元で invoke メソッドを呼び出す必要があるかどうかを示す値を取得します。

(継承元 Control)
IsAccessible

コントロールがユーザー補助アプリケーションに表示されるかどうかを示す値を取得または設定します。

(継承元 Control)
IsAncestorSiteInDesignMode

このコントロールの先祖の 1 つがサイトに存在し、そのサイトが DesignMode 内にあるかどうかを示します。 このプロパティは読み取り専用です。

(継承元 Control)
IsDisposed

コントロールが破棄されているかどうかを示す値を取得します。

(継承元 Control)
IsHandleCreated

コントロールにハンドルが関連付けられているかどうかを示す値を取得します。

(継承元 Control)
IsMirrored

コントロールがミラー化されるかどうかを示す値を取得します。

(継承元 Control)
Item[DataGridCell]

指定した DataGridCell の値を取得または設定します。

Item[Int32, Int32]

指定した行および列にあるセルの値を取得または設定します。

LayoutEngine

コントロールのレイアウト エンジンのキャッシュ インスタンスを取得します。

(継承元 Control)
Left

コントロールの左端とコンテナーのクライアント領域の左端の間の距離をピクセルで取得または設定します。

(継承元 Control)
LinkColor

クリックすると子テーブルに移動できるテキストの色を取得または設定します。

LinkHoverColor

このコントロールでは、このメンバーは無効です。

ListManager

この CurrencyManager コントロールの DataGrid を取得します。

Location

コンテナーの左上隅に対する相対座標として、コントロールの左上隅の座標を取得または設定します。

(継承元 Control)
Margin

コントロール間の空白を取得または設定します。

(継承元 Control)
MaximumSize

GetPreferredSize(Size) が指定できる上限のサイズを取得または設定します。

(継承元 Control)
MinimumSize

GetPreferredSize(Size) が指定できる下限のサイズを取得または設定します。

(継承元 Control)
Name

コントロールの名前を取得または設定します。

(継承元 Control)
Padding

コントロールの埋め込みを取得または設定します。

(継承元 Control)
Parent

コントロールの親コンテナーを取得または設定します。

(継承元 Control)
ParentRowsBackColor

親行の背景色を取得または設定します。

ParentRowsForeColor

親行の前景色を取得または設定します。

ParentRowsLabelStyle

親行ラベルの表示方法を取得または設定します。

ParentRowsVisible

テーブルの親行を表示するかどうかを示す値を取得または設定します。

PreferredColumnWidth

グリッドの既定の列幅 (ピクセル単位) を取得または設定します。

PreferredRowHeight

DataGrid コントロールの行の適切な高さを取得または設定します。

PreferredSize

コントロールが適合する四角形領域のサイズを取得します。

(継承元 Control)
ProductName

コントロールを格納しているアセンブリの製品名を取得します。

(継承元 Control)
ProductVersion

コントロールを格納しているアセンブリのバージョンを取得します。

(継承元 Control)
ReadOnly

グリッドが読み取り専用モードかどうかを示す値を取得または設定します。

RecreatingHandle

コントロールが現在そのコントロールのハンドルを再作成中かどうかを示す値を取得します。

(継承元 Control)
Region

コントロールに関連付けられたウィンドウ領域を取得または設定します。

(継承元 Control)
RenderRightToLeft
古い.
古い.

このプロパティは使用されなくなりました。

(継承元 Control)
ResizeRedraw

サイズが変更されたときに、コントロールがコントロール自体を再描画するかどうかを示す値を取得または設定します。

(継承元 Control)
Right

コントロールの右端とコンテナーのクライアント領域の左端の間の距離をピクセルで取得します。

(継承元 Control)
RightToLeft

コントロールの要素が、右から左へ表示されるフォントを使用するロケールをサポートするように配置されているかどうかを示す値を取得または設定します。

(継承元 Control)
RowHeadersVisible

行ヘッダーを表示するかどうかを指定する値を取得または設定します。

RowHeaderWidth

行ヘッダーの幅を取得または設定します。

ScaleChildren

子コントロールの表示スケールを決定する値を取得します。

(継承元 Control)
SelectionBackColor

選択された行の背景色を取得または設定します。

SelectionForeColor

選択された行の前景色を取得または設定します。

ShowFocusCues

コントロールがフォーカスを示す四角形を表示する必要があるかどうかを示す値を取得します。

(継承元 Control)
ShowKeyboardCues

ユーザー インターフェイスがキーボード アクセラレータを表示または非表示にする適切な状態かどうかを示す値を取得します。

(継承元 Control)
Site

コントロールのサイトを取得または設定します。

Size

コントロールの高さと幅を取得または設定します。

(継承元 Control)
TabIndex

コンテナー内のコントロールのタブ オーダーを取得または設定します。

(継承元 Control)
TableStyles

グリッドの DataGridTableStyle オブジェクトのコレクションを取得します。

TabStop

ユーザーが Tab キーを使用することによってこのコントロールにフォーカスを移すことができるかどうかを示す値を取得または設定します。

(継承元 Control)
Tag

コントロールに関するデータを格納するオブジェクトを取得または設定します。

(継承元 Control)
Text

このコントロールでは、このメンバーは無効です。

Top

コントロールの上端とコンテナーのクライアント領域の上端の間の距離をピクセル単位で取得または設定します。

(継承元 Control)
TopLevelControl

別の Windows フォーム コントロールを親として持たない親コントロールを取得します。 一般的に、これは、コントロールを格納している最も外側の Form です。

(継承元 Control)
UseWaitCursor

現在のコントロールおよびすべての子コントロールに待機カーソルを使用するかどうかを示す値を取得または設定します。

(継承元 Control)
VertScrollBar

コントロールの垂直スクロール バーを取得します。

Visible

コントロールとそのすべての子コントロールが表示されているかどうかを示す値を取得または設定します。

(継承元 Control)
VisibleColumnCount

表示される列の数を取得します。

VisibleRowCount

表示される行の数を取得します。

Width

コントロールの幅を取得または設定します。

(継承元 Control)
WindowTarget

このクラスでは、このプロパティは使用されません。

(継承元 Control)

メソッド

AccessibilityNotifyClients(AccessibleEvents, Int32)

指定した子コントロールの指定した AccessibleEvents をユーザー補助クライアント アプリケーションに通知します。

(継承元 Control)
AccessibilityNotifyClients(AccessibleEvents, Int32, Int32)

指定した子コントロールの指定した AccessibleEvents をユーザー補助クライアント アプリケーションに通知します。

(継承元 Control)
BeginEdit(DataGridColumnStyle, Int32)

グリッドが編集できる状態に移行するよう試みます。

BeginInit()

フォームまたは別のコンポーネントで使用する DataGrid の初期化を開始します。 初期化は実行時に発生します。

BeginInvoke(Action)

コントロールの基になるハンドルが作成されたスレッド上で、指定したデリゲートを非同期的に実行します。

(継承元 Control)
BeginInvoke(Delegate)

コントロールの基になるハンドルが作成されたスレッド上で、指定したデリゲートを非同期的に実行します。

(継承元 Control)
BeginInvoke(Delegate, Object[])

コントロールの基になるハンドルが作成されたスレッド上で、指定した引数で指定したデリゲートを非同期的に実行します。

(継承元 Control)
BringToFront()

コントロールを z オーダーの最前面へ移動します。

(継承元 Control)
CancelEditing()

現在の編集操作をキャンセルし、すべての変更をロールバックします。

Collapse(Int32)

子リレーションシップがすべての行または指定した行に存在する場合、子リレーションシップを折りたたみます。

ColumnStartedEditing(Control)

ユーザーが指定したコントロールを使用して列の編集を開始すると、DataGrid コントロールに通知します。

ColumnStartedEditing(Rectangle)

ユーザーが指定した位置にある列の編集を開始すると、DataGrid コントロールに通知します。

Contains(Control)

指定したコントロールが、コントロールの子かどうかを示す値を取得します。

(継承元 Control)
CreateAccessibilityInstance()

このコントロールのアクセシビリティ オブジェクトの新しいインスタンスを構築します。

CreateControl()

ハンドルおよび子コントロールの作成を含めて、強制的に表示子コントロールを作成します。

(継承元 Control)
CreateControlsInstance()

コントロールのコントロール コレクションの新しいインスタンスを作成します。

(継承元 Control)
CreateGraphics()

コントロールの Graphics を作成します。

(継承元 Control)
CreateGridColumn(PropertyDescriptor)

指定した DataGridColumnStyle を使用して、新しい PropertyDescriptor を作成します。

CreateGridColumn(PropertyDescriptor, Boolean)

指定した DataGridColumnStyle を使用して PropertyDescriptor を作成します。

CreateHandle()

コントロールのハンドルを作成します。

(継承元 Control)
CreateObjRef(Type)

リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。

(継承元 MarshalByRefObject)
DefWndProc(Message)

指定したメッセージを既定のウィンドウ プロシージャに送信します。

(継承元 Control)
DestroyHandle()

コントロールに関連付けられたハンドルを破棄します。

(継承元 Control)
Dispose()

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

(継承元 Component)
Dispose(Boolean)

DataGrid で使用されていたリソース (メモリを除く) を解放します。

DoDragDrop(Object, DragDropEffects)

ドラッグ アンド ドロップ操作を開始します。

(継承元 Control)
DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean)

ドラッグ操作を開始します。

(継承元 Control)
DrawToBitmap(Bitmap, Rectangle)

指定したビットマップへのレンダリングをサポートします。

(継承元 Control)
EndEdit(DataGridColumnStyle, Int32, Boolean)

DataGrid コントロールで実行している編集操作の終了を要求します。

EndInit()

フォームまたは別のコンポーネントで使用する DataGrid の初期化を終了します。 初期化は実行時に発生します。

EndInvoke(IAsyncResult)

渡された IAsyncResult によって表される、非同期操作の戻り値を取得します。

(継承元 Control)
Equals(Object)

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

(継承元 Object)
Expand(Int32)

子リレーションシップがすべての行または特定の行に存在する場合に、子リレーションシップを表示します。

FindForm()

コントロールがあるフォームを取得します。

(継承元 Control)
Focus()

コントロールに入力フォーカスを設定します。

(継承元 Control)
GetAccessibilityObjectById(Int32)

指定した AccessibleObject を取得します。

(継承元 Control)
GetAutoSizeMode()

AutoSize プロパティが有効なときのコントロールの動作を示す値を取得します。

(継承元 Control)
GetCellBounds(DataGridCell)

Rectangle で指定したセルの DataGridCell を取得します。

GetCellBounds(Int32, Int32)

行番号および列番号で指定したセルの Rectangle を取得します。

GetChildAtPoint(Point)

指定した座標にある子コントロールを取得します。

(継承元 Control)
GetChildAtPoint(Point, GetChildAtPointSkip)

特定の種類の子コントロールを無視するかどうかを指定して、指定した座標にある子コントロールを取得します。

(継承元 Control)
GetContainerControl()

コントロールの親チェインの 1 つ上の ContainerControl を返します。

(継承元 Control)
GetCurrentCellBounds()

選択されたセルの四隅を指定する Rectangle を取得します。

GetHashCode()

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

(継承元 Object)
GetLifetimeService()
古い.

対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
GetNextControl(Control, Boolean)

子コントロールのタブ オーダー内の 1 つ前または 1 つ後ろのコントロールを取得します。

(継承元 Control)
GetOutputTextDelimiter()

行のコンテンツをクリップボードにコピーするときに、列間の区切り文字となる文字列を取得します。

GetPreferredSize(Size)

コントロールが収まる四角形の領域のサイズを取得します。

(継承元 Control)
GetScaledBounds(Rectangle, SizeF, BoundsSpecified)

コントロールのスケールが設定される境界を取得します。

(継承元 Control)
GetService(Type)

Component またはその Container で提供されるサービスを表すオブジェクトを返します。

(継承元 Component)
GetStyle(ControlStyles)

コントロールの指定したコントロール スタイル ビットの値を取得します。

(継承元 Control)
GetTopLevel()

コントロールがトップレベル コントロールかどうかを判断します。

(継承元 Control)
GetType()

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

(継承元 Object)
GridHScrolled(Object, ScrollEventArgs)

水平スクロール バーのスクロール イベントを待機します。

GridVScrolled(Object, ScrollEventArgs)

垂直スクロール バーのスクロール イベントを待機します。

Hide()

コントロールをユーザーに対して非表示にします。

(継承元 Control)
HitTest(Int32, Int32)

このメソッドに渡された x、y 座標を使用して、グリッド上でクリックされたポイントの行番号や列番号などの情報を取得します。

HitTest(Point)

特定の Point を使用して、クリックされたグリッド上のポイントの行番号や列番号など、グリッドに関する情報を取得します。

InitializeLifetimeService()
古い.

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。

(継承元 MarshalByRefObject)
InitLayout()

コントロールが別のコンテナーに追加された後、呼び出されます。

(継承元 Control)
Invalidate()

コントロールの表面全体を無効化して、コントロールを再描画します。

(継承元 Control)
Invalidate(Boolean)

コントロールの特定の領域を無効にし、そのコントロールに描画メッセージを送信します。 オプションとして、そのコントロールに割り当てられている子コントロールも無効にします。

(継承元 Control)
Invalidate(Rectangle)

コントロールの指定した領域を無効にし (そのコントロールの次の描画操作で再描画される領域を示す更新領域に追加し)、描画メッセージがそのコントロールに送信されるようにします。

(継承元 Control)
Invalidate(Rectangle, Boolean)

コントロールの指定した領域を無効にし (そのコントロールの次の描画操作で再描画される領域を示す更新領域に追加し)、描画メッセージがそのコントロールに送信されるようにします。 オプションとして、そのコントロールに割り当てられている子コントロールも無効にします。

(継承元 Control)
Invalidate(Region)

コントロールの指定した領域を無効にし (そのコントロールの次の描画操作で再描画される領域を示す更新領域に追加し)、描画メッセージがそのコントロールに送信されるようにします。

(継承元 Control)
Invalidate(Region, Boolean)

コントロールの指定した領域を無効にし (そのコントロールの次の描画操作で再描画される領域を示す更新領域に追加し)、描画メッセージがそのコントロールに送信されるようにします。 オプションとして、そのコントロールに割り当てられている子コントロールも無効にします。

(継承元 Control)
Invoke(Action)

コントロールの基になるウィンドウ ハンドルを所有するスレッド上で、指定したデリゲートを実行します。

(継承元 Control)
Invoke(Delegate)

コントロールの基になるウィンドウ ハンドルを所有するスレッド上で、指定したデリゲートを実行します。

(継承元 Control)
Invoke(Delegate, Object[])

コントロールの基になるウィンドウ ハンドルを所有するスレッド上で、指定した引数リストを使用して、指定したデリゲートを実行します。

(継承元 Control)
Invoke<T>(Func<T>)

コントロールの基になるウィンドウ ハンドルを所有するスレッド上で、指定したデリゲートを実行します。

(継承元 Control)
InvokeGotFocus(Control, EventArgs)

指定したコントロールの GotFocus イベントを発生させます。

(継承元 Control)
InvokeLostFocus(Control, EventArgs)

指定したコントロールの LostFocus イベントを発生させます。

(継承元 Control)
InvokeOnClick(Control, EventArgs)

指定したコントロールの Click イベントを発生させます。

(継承元 Control)
InvokePaint(Control, PaintEventArgs)

指定したコントロールの Paint イベントを発生させます。

(継承元 Control)
InvokePaintBackground(Control, PaintEventArgs)

指定したコントロールの PaintBackground イベントを発生させます。

(継承元 Control)
IsExpanded(Int32)

指定した行のノードを展開するか、折りたたむかを示す値を取得します。

IsInputChar(Char)

文字が、コントロールによって認識される入力文字かどうかを判断します。

(継承元 Control)
IsInputKey(Keys)

指定されているキーが、通常の入力キーであるか、またはプリプロセスを必要とする特殊なキーであるかを確認します。

(継承元 Control)
IsSelected(Int32)

指定した行が選択されているかどうかを示す値を取得します。

LogicalToDeviceUnits(Int32)

論理 DPI 値をその同等 DeviceUnit DPI 値に変換します。

(継承元 Control)
LogicalToDeviceUnits(Size)

現在の DPI に合わせて拡大縮小し、幅と高さを最も近い整数値に丸めることで論理単位からデバイス単位にサイズを変換します。

(継承元 Control)
MemberwiseClone()

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

(継承元 Object)
MemberwiseClone(Boolean)

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。

(継承元 MarshalByRefObject)
NavigateBack()

以前グリッドに表示されたテーブルに戻ります。

NavigateTo(Int32, String)

行とリレーションシップ名で指定したテーブルに移動します。

NotifyInvalidate(Rectangle)

無効化するコントロールの領域を指定して、Invalidated イベントを発生させます。

(継承元 Control)
OnAllowNavigationChanged(EventArgs)

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

OnAutoSizeChanged(EventArgs)

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

(継承元 Control)
OnBackButtonClicked(Object, EventArgs)

キャプションの [戻る] ボタンがクリックされるイベントを待機します。

OnBackColorChanged(EventArgs)

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

OnBackgroundColorChanged(EventArgs)

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

OnBackgroundImageChanged(EventArgs)

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

(継承元 Control)
OnBackgroundImageLayoutChanged(EventArgs)

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

(継承元 Control)
OnBindingContextChanged(EventArgs)

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

OnBorderStyleChanged(EventArgs)

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

OnCaptionVisibleChanged(EventArgs)

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

OnCausesValidationChanged(EventArgs)

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

(継承元 Control)
OnChangeUICues(UICuesEventArgs)

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

(継承元 Control)
OnClick(EventArgs)

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

(継承元 Control)
OnClientSizeChanged(EventArgs)

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

(継承元 Control)
OnContextMenuChanged(EventArgs)

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

(継承元 Control)
OnContextMenuStripChanged(EventArgs)

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

(継承元 Control)
OnControlAdded(ControlEventArgs)

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

(継承元 Control)
OnControlRemoved(ControlEventArgs)

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

(継承元 Control)
OnCreateControl()

CreateControl() メソッドを発生させます。

(継承元 Control)
OnCurrentCellChanged(EventArgs)

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

OnCursorChanged(EventArgs)

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

(継承元 Control)
OnDataContextChanged(EventArgs)

スクロールできるグリッドに ADO.NET データを表示します。

このクラスは .NET Core 3.1 以降のバージョンでは利用できません。 代わりに コントロールを DataGridView 使用します。このコントロールは、コントロールを置き換えて拡張します DataGrid

(継承元 Control)
OnDataSourceChanged(EventArgs)

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

OnDockChanged(EventArgs)

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

(継承元 Control)
OnDoubleClick(EventArgs)

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

(継承元 Control)
OnDpiChangedAfterParent(EventArgs)

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

(継承元 Control)
OnDpiChangedBeforeParent(EventArgs)

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

(継承元 Control)
OnDragDrop(DragEventArgs)

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

(継承元 Control)
OnDragEnter(DragEventArgs)

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

(継承元 Control)
OnDragLeave(EventArgs)

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

(継承元 Control)
OnDragOver(DragEventArgs)

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

(継承元 Control)
OnEnabledChanged(EventArgs)

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

(継承元 Control)
OnEnter(EventArgs)

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

OnFlatModeChanged(EventArgs)

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

OnFontChanged(EventArgs)

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

OnForeColorChanged(EventArgs)

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

OnGiveFeedback(GiveFeedbackEventArgs)

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

(継承元 Control)
OnGotFocus(EventArgs)

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

(継承元 Control)
OnHandleCreated(EventArgs)

CreateHandle() イベントを発生させます。

OnHandleDestroyed(EventArgs)

DestroyHandle() イベントを発生させます。

OnHelpRequested(HelpEventArgs)

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

(継承元 Control)
OnImeModeChanged(EventArgs)

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

(継承元 Control)
OnInvalidated(InvalidateEventArgs)

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

(継承元 Control)
OnKeyDown(KeyEventArgs)

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

OnKeyPress(KeyPressEventArgs)

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

OnKeyUp(KeyEventArgs)

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

(継承元 Control)
OnLayout(LayoutEventArgs)

コントロールを移動してスクロール バーを更新する Layout イベントを発生させます。

OnLeave(EventArgs)

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

OnLocationChanged(EventArgs)

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

(継承元 Control)
OnLostFocus(EventArgs)

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

(継承元 Control)
OnMarginChanged(EventArgs)

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

(継承元 Control)
OnMouseCaptureChanged(EventArgs)

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

(継承元 Control)
OnMouseClick(MouseEventArgs)

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

(継承元 Control)
OnMouseDoubleClick(MouseEventArgs)

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

(継承元 Control)
OnMouseDown(MouseEventArgs)

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

OnMouseEnter(EventArgs)

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

(継承元 Control)
OnMouseHover(EventArgs)

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

(継承元 Control)
OnMouseLeave(EventArgs)

MouseLeave イベントを作成します。

OnMouseMove(MouseEventArgs)

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

OnMouseUp(MouseEventArgs)

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

OnMouseWheel(MouseEventArgs)

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

OnMove(EventArgs)

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

(継承元 Control)
OnNavigate(NavigateEventArgs)

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

OnNotifyMessage(Message)

コントロールに Windows メッセージを通知します。

(継承元 Control)
OnPaddingChanged(EventArgs)

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

(継承元 Control)
OnPaint(PaintEventArgs)

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

OnPaintBackground(PaintEventArgs)

OnPaintBackground(PaintEventArgs) コントロールの背景を描画しないように、DataGrid をオーバーライドします。

OnParentBackColorChanged(EventArgs)

コントロールのコンテナーの BackColorChanged プロパティ値が変更された場合に、BackColor イベントを発生させます。

(継承元 Control)
OnParentBackgroundImageChanged(EventArgs)

コントロールのコンテナーの BackgroundImageChanged プロパティ値が変更された場合に、BackgroundImage イベントを発生させます。

(継承元 Control)
OnParentBindingContextChanged(EventArgs)

コントロールのコンテナーの BindingContextChanged プロパティ値が変更された場合に、BindingContext イベントを発生させます。

(継承元 Control)
OnParentChanged(EventArgs)

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

(継承元 Control)
OnParentCursorChanged(EventArgs)

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

(継承元 Control)
OnParentDataContextChanged(EventArgs)

スクロールできるグリッドに ADO.NET データを表示します。

このクラスは .NET Core 3.1 以降のバージョンでは利用できません。 代わりに コントロールを DataGridView 使用します。このコントロールは、コントロールを置き換えて拡張します DataGrid

(継承元 Control)
OnParentEnabledChanged(EventArgs)

コントロールのコンテナーの EnabledChanged プロパティ値が変更された場合に、Enabled イベントを発生させます。

(継承元 Control)
OnParentFontChanged(EventArgs)

コントロールのコンテナーの FontChanged プロパティ値が変更された場合に、Font イベントを発生させます。

(継承元 Control)
OnParentForeColorChanged(EventArgs)

コントロールのコンテナーの ForeColorChanged プロパティ値が変更された場合に、ForeColor イベントを発生させます。

(継承元 Control)
OnParentRightToLeftChanged(EventArgs)

コントロールのコンテナーの RightToLeftChanged プロパティ値が変更された場合に、RightToLeft イベントを発生させます。

(継承元 Control)
OnParentRowsLabelStyleChanged(EventArgs)

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

OnParentRowsVisibleChanged(EventArgs)

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

OnParentVisibleChanged(EventArgs)

コントロールのコンテナーの VisibleChanged プロパティ値が変更された場合に、Visible イベントを発生させます。

(継承元 Control)
OnPreviewKeyDown(PreviewKeyDownEventArgs)

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

(継承元 Control)
OnPrint(PaintEventArgs)

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

(継承元 Control)
OnQueryContinueDrag(QueryContinueDragEventArgs)

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

(継承元 Control)
OnReadOnlyChanged(EventArgs)

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

OnRegionChanged(EventArgs)

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

(継承元 Control)
OnResize(EventArgs)

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

OnRightToLeftChanged(EventArgs)

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

(継承元 Control)
OnRowHeaderClick(EventArgs)

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

OnScroll(EventArgs)

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

OnShowParentDetailsButtonClicked(Object, EventArgs)

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

OnSizeChanged(EventArgs)

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

(継承元 Control)
OnStyleChanged(EventArgs)

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

(継承元 Control)
OnSystemColorsChanged(EventArgs)

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

(継承元 Control)
OnTabIndexChanged(EventArgs)

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

(継承元 Control)
OnTabStopChanged(EventArgs)

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

(継承元 Control)
OnTextChanged(EventArgs)

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

(継承元 Control)
OnValidated(EventArgs)

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

(継承元 Control)
OnValidating(CancelEventArgs)

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

(継承元 Control)
OnVisibleChanged(EventArgs)

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

(継承元 Control)
PerformLayout()

コントロールがレイアウト ロジックをすべての子コントロールに適用するように強制します。

(継承元 Control)
PerformLayout(Control, String)

コントロールがレイアウト ロジックをすべての子コントロールに適用するように強制します。

(継承元 Control)
PointToClient(Point)

指定した画面上のポイントを計算してクライアント座標を算出します。

(継承元 Control)
PointToScreen(Point)

指定したクライアント ポイントを計算して画面座標を算出します。

(継承元 Control)
PreProcessControlMessage(Message)

キーボード メッセージまたは入力メッセージがディスパッチされる前に、メッセージ ループ内の入力メッセージを前処理します。

(継承元 Control)
PreProcessMessage(Message)

キーボード メッセージまたは入力メッセージがディスパッチされる前に、メッセージ ループ内の入力メッセージを前処理します。

(継承元 Control)
ProcessCmdKey(Message, Keys)

コマンド キーを処理します。

(継承元 Control)
ProcessDialogChar(Char)

ダイアログ文字を処理します。

(継承元 Control)
ProcessDialogKey(Keys)

キーを処理する必要があるかどうかを示す値を取得または設定します。

ProcessGridKey(KeyEventArgs)

グリッドを移動するためのキーを処理します。

ProcessKeyEventArgs(Message)

キー メッセージを処理し、適切なコントロール イベントを生成します。

(継承元 Control)
ProcessKeyMessage(Message)

キーボード メッセージを処理します。

(継承元 Control)
ProcessKeyPreview(Message)

キーボードによるメッセージをプレビューし、キーが使用されたかどうかを示す値を返します。

ProcessMnemonic(Char)

ニーモニック文字を処理します。

(継承元 Control)
ProcessTabKey(Keys)

Tab キーを処理する必要があるかどうかを示す値を取得します。

RaiseDragEvent(Object, DragEventArgs)

適切なドラッグ イベントを発生させます。

(継承元 Control)
RaiseKeyEvent(Object, KeyEventArgs)

適切なキー イベントを発生させます。

(継承元 Control)
RaiseMouseEvent(Object, MouseEventArgs)

適切なマウス イベントを発生させます。

(継承元 Control)
RaisePaintEvent(Object, PaintEventArgs)

適切な描画イベントを発生させます。

(継承元 Control)
RecreateHandle()

強制的にコントロールのハンドルを再作成します。

(継承元 Control)
RectangleToClient(Rectangle)

指定した画面上の四角形のサイズと位置をクライアント座標で算出します。

(継承元 Control)
RectangleToScreen(Rectangle)

指定したクライアント領域の四角形のサイズと位置を画面座標で算出します。

(継承元 Control)
Refresh()

強制的に、コントロールがクライアント領域を無効化し、直後にそのコントロール自体とその子コントロールを再描画するようにします。

(継承元 Control)
RescaleConstantsForDpi(Int32, Int32)

DPI の変更が発生したときに、コントロールの再スケーリングの定数を提供します。

(継承元 Control)
ResetAlternatingBackColor()

AlternatingBackColor プロパティを既定の色にリセットします。

ResetBackColor()

BackColor プロパティを既定値にリセットします。

ResetBindings()

BindingSource にバインドされたコントロールに対し、リスト内のすべての項目を再度読み込んで表示値を更新するよう通知します。

(継承元 Control)
ResetCursor()

Cursor プロパティを既定値にリセットします。

(継承元 Control)
ResetFont()

Font プロパティを既定値にリセットします。

(継承元 Control)
ResetForeColor()

ForeColor プロパティを既定値にリセットします。

ResetGridLineColor()

GridLineColor プロパティを既定値にリセットします。

ResetHeaderBackColor()

HeaderBackColor プロパティを既定値にリセットします。

ResetHeaderFont()

HeaderFont プロパティを既定値にリセットします。

ResetHeaderForeColor()

HeaderForeColor プロパティを既定値にリセットします。

ResetImeMode()

ImeMode プロパティを既定値にリセットします。

(継承元 Control)
ResetLinkColor()

LinkColor プロパティを既定値にリセットします。

ResetLinkHoverColor()

LinkHoverColor プロパティを既定値にリセットします。

ResetMouseEventArgs()

MouseLeave イベントを処理するためのコントロールをリセットします。

(継承元 Control)
ResetRightToLeft()

RightToLeft プロパティを既定値にリセットします。

(継承元 Control)
ResetSelection()

選択されているすべての行についての選択項目をオフにします。

ResetSelectionBackColor()

SelectionBackColor プロパティを既定値にリセットします。

ResetSelectionForeColor()

SelectionForeColor プロパティを既定値にリセットします。

ResetText()

Text プロパティを既定値 (Empty) にリセットします。

(継承元 Control)
ResumeLayout()

通常のレイアウト ロジックを再開します。

(継承元 Control)
ResumeLayout(Boolean)

通常のレイアウト ロジックを再開します。オプションで、保留中のレイアウト要求のレイアウトを強制的に即時実行します。

(継承元 Control)
RtlTranslateAlignment(ContentAlignment)

指定した ContentAlignment を適切な ContentAlignment に変換し、テキストを右から左に表示できるようにします。

(継承元 Control)
RtlTranslateAlignment(HorizontalAlignment)

指定した HorizontalAlignment を適切な HorizontalAlignment に変換し、テキストを右から左に表示できるようにします。

(継承元 Control)
RtlTranslateAlignment(LeftRightAlignment)

指定した LeftRightAlignment を適切な LeftRightAlignment に変換し、テキストを右から左に表示できるようにします。

(継承元 Control)
RtlTranslateContent(ContentAlignment)

指定した ContentAlignment を適切な ContentAlignment に変換し、テキストを右から左に表示できるようにします。

(継承元 Control)
RtlTranslateHorizontal(HorizontalAlignment)

指定した HorizontalAlignment を適切な HorizontalAlignment に変換し、テキストを右から左に表示できるようにします。

(継承元 Control)
RtlTranslateLeftRight(LeftRightAlignment)

指定した LeftRightAlignment を適切な LeftRightAlignment に変換し、テキストを右から左に表示できるようにします。

(継承元 Control)
Scale(Single)
古い.
古い.

コントロールおよび子コントロールのスケールを設定します。

(継承元 Control)
Scale(Single, Single)
古い.
古い.

コントロール全体および子コントロールのスケールを設定します。

(継承元 Control)
Scale(SizeF)

指定されたスケール ファクターによってコントロールおよびすべての子コントロールのスケールを設定します。

(継承元 Control)
ScaleBitmapLogicalToDevice(Bitmap)

DPI の変更が発生したときに、同等のデバイス単位値に論理ビットマップ値のスケールを設定します。

(継承元 Control)
ScaleControl(SizeF, BoundsSpecified)

コントロールの位置、サイズ、埋め込み、およびマージンのスケールを設定します。

(継承元 Control)
ScaleCore(Single, Single)

このクラスでは、このメソッドは無効です。

(継承元 Control)
Select()

コントロールをアクティブにします。

(継承元 Control)
Select(Boolean, Boolean)

子コントロールをアクティブにします。 オプションとして、タブ オーダーでコントロールを選択するときの方向を指定します。

(継承元 Control)
Select(Int32)

指定した行を選択します。

SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean)

次のコントロールをアクティブにします。

(継承元 Control)
SendToBack()

コントロールを z オーダーの背面に移動します。

(継承元 Control)
SetAutoSizeMode(AutoSizeMode)

AutoSize プロパティが有効なときのコントロールの動作を示す値を設定します。

(継承元 Control)
SetBounds(Int32, Int32, Int32, Int32)

コントロールの範囲を指定した位置とサイズに設定します。

(継承元 Control)
SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)

コントロールの指定した範囲を指定した位置とサイズに設定します。

(継承元 Control)
SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)

このコントロールの指定した境界を設定する作業を実行します。

(継承元 Control)
SetClientSizeCore(Int32, Int32)

コントロールのクライアント領域のサイズを設定します。

(継承元 Control)
SetDataBinding(Object, String)

実行時に DataSource プロパティと DataMember プロパティを設定します。

SetStyle(ControlStyles, Boolean)

指定した ControlStyles フラグを true または false に設定します。

(継承元 Control)
SetTopLevel(Boolean)

コントロールをトップレベル コントロールとして設定します。

(継承元 Control)
SetVisibleCore(Boolean)

コントロールを指定した表示状態に設定します。

(継承元 Control)
ShouldSerializeAlternatingBackColor()

AlternatingBackColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeBackgroundColor()

BackgroundColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeCaptionBackColor()

CaptionBackColor プロパティを永続化する必要があるかどうかを示す値を取得します。

ShouldSerializeCaptionForeColor()

CaptionForeColor プロパティを永続化する必要があるかどうかを示す値を取得します。

ShouldSerializeGridLineColor()

GridLineColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeHeaderBackColor()

HeaderBackColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeHeaderFont()

HeaderFont プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeHeaderForeColor()

HeaderForeColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeLinkHoverColor()

LinkHoverColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeParentRowsBackColor()

ParentRowsBackColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeParentRowsForeColor()

ParentRowsForeColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializePreferredRowHeight()

PreferredRowHeight プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeSelectionBackColor()

SelectionBackColor プロパティを永続化する必要があるかどうかを示します。

ShouldSerializeSelectionForeColor()

SelectionForeColor プロパティを永続化する必要があるかどうかを示します。

Show()

コントロールをユーザーに対して表示します。

(継承元 Control)
SizeFromClientSize(Size)

クライアント領域の高さおよび幅からコントロール全体のサイズを決定します。

(継承元 Control)
SubObjectsSiteChange(Boolean)

DataGridTableStyle に関連付けられているコンテナーに DataGrid オブジェクトを追加するか、コンテナーからそのオブジェクトを削除します。

SuspendLayout()

コントロールのレイアウト ロジックを一時的に中断します。

(継承元 Control)
ToString()

Component の名前 (存在する場合) を格納する String を返します。 このメソッドはオーバーライドできません。

(継承元 Component)
UnSelect(Int32)

指定した行の選択を解除します。

Update()

コントロールによって、クライアント領域内の無効化された領域が再描画されます。

(継承元 Control)
UpdateBounds()

コントロールの範囲を現在のサイズと位置で更新します。

(継承元 Control)
UpdateBounds(Int32, Int32, Int32, Int32)

コントロールの範囲を指定したサイズと位置で更新します。

(継承元 Control)
UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)

コントロールの範囲を指定したサイズ、位置、およびクライアント サイズで更新します。

(継承元 Control)
UpdateStyles()

割り当て済みのスタイルを強制的にコントロールに再適用します。

(継承元 Control)
UpdateZOrder()

コントロールを親の z オーダーで更新します。

(継承元 Control)
WndProc(Message)

Windows メッセージを処理します。

(継承元 Control)

イベント

AllowNavigationChanged

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

AutoSizeChanged

このクラスでは、このイベントは使用されません。

(継承元 Control)
BackButtonClick

子テーブルの Back ボタンがクリックされると発生します。

BackColorChanged

BackColor プロパティの値が変化したときに発生します。

(継承元 Control)
BackgroundColorChanged

BackgroundColor が変更された場合に発生します。

BackgroundImageChanged

BackgroundImage プロパティの値が変化したときに発生します。

BackgroundImageLayoutChanged

BackgroundImageLayout プロパティの値が変化したときに発生します。

BackgroundImageLayoutChanged

BackgroundImageLayout プロパティが変更されたときに発生します。

(継承元 Control)
BindingContextChanged

BindingContext プロパティの値が変化したときに発生します。

(継承元 Control)
BorderStyleChanged

BorderStyle が変更された場合に発生します。

CaptionVisibleChanged

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

CausesValidationChanged

CausesValidation プロパティの値が変化したときに発生します。

(継承元 Control)
ChangeUICues

フォーカスまたはキーボードのユーザー インターフェイス (UI) キューが変更されるときに発生します。

(継承元 Control)
Click

コントロールがクリックされたときに発生します。

(継承元 Control)
ClientSizeChanged

ClientSize プロパティの値が変化したときに発生します。

(継承元 Control)
ContextMenuChanged

ContextMenu プロパティの値が変化したときに発生します。

(継承元 Control)
ContextMenuStripChanged

ContextMenuStrip プロパティの値が変化したときに発生します。

(継承元 Control)
ControlAdded

新しいコントロールが Control.ControlCollection に追加されたときに発生します。

(継承元 Control)
ControlRemoved

Control.ControlCollection からコントロールが削除されたときに発生します。

(継承元 Control)
CurrentCellChanged

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

CursorChanged

Cursor プロパティの値が変化したときに発生します。

DataContextChanged

DataContext プロパティの値が変化したときに発生します。

(継承元 Control)
DataSourceChanged

DataSource プロパティ値が変更されたときに発生します。

Disposed

Dispose() メソッドの呼び出しによってコンポーネントが破棄されるときに発生します。

(継承元 Component)
DockChanged

Dock プロパティの値が変化したときに発生します。

(継承元 Control)
DoubleClick

コントロールがダブルクリックされたときに発生します。

(継承元 Control)
DpiChangedAfterParent

親コントロールまたはフォームの DPI が変更された後に、コントロールの DPI 設定がプログラムで変更されたときに発生します。

(継承元 Control)
DpiChangedBeforeParent

親コントロールまたはフォームの DPI 変更イベントが発生する前に、コントロールの DPI 設定がプログラムで変更されたときに発生します。

(継承元 Control)
DragDrop

ドラッグ アンド ドロップ操作が完了したときに発生します。

(継承元 Control)
DragEnter

オブジェクトがコントロールの境界内にドラッグされると発生します。

(継承元 Control)
DragLeave

オブジェクトがコントロールの境界外にドラッグされたときに発生します。

(継承元 Control)
DragOver

オブジェクトがコントロールの境界を越えてドラッグされると発生します。

(継承元 Control)
EnabledChanged

Enabled プロパティ値が変更されたときに発生します。

(継承元 Control)
Enter

コントロールが入力されると発生します。

(継承元 Control)
FlatModeChanged

FlatMode が変更された場合に発生します。

FontChanged

Font プロパティの値が変化すると発生します。

(継承元 Control)
ForeColorChanged

ForeColor プロパティの値が変化すると発生します。

(継承元 Control)
GiveFeedback

ドラッグ操作中に発生します。

(継承元 Control)
GotFocus

コントロールがフォーカスを受け取ると発生します。

(継承元 Control)
HandleCreated

コントロールに対してハンドルが作成されると発生します。

(継承元 Control)
HandleDestroyed

コントロールのハンドルが破棄されているときに発生します。

(継承元 Control)
HelpRequested

ユーザーがコントロールのヘルプを要求すると発生します。

(継承元 Control)
ImeModeChanged

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

(継承元 Control)
Invalidated

コントロールの表示に再描画が必要なときに発生します。

(継承元 Control)
KeyDown

コントロールにフォーカスがあるときにキーが押されると発生します。

(継承元 Control)
KeyPress

コントロールにフォーカスがあるときに、文字、 スペース、または Backspace キーが押された場合に発生します。

(継承元 Control)
KeyUp

コントロールにフォーカスがあるときにキーが離されると発生します。

(継承元 Control)
Layout

コントロールの子コントロールの位置を変更する必要があるときに発生します。

(継承元 Control)
Leave

入力フォーカスがコントロールを離れると発生します。

(継承元 Control)
LocationChanged

Location プロパティ値が変更されたときに発生します。

(継承元 Control)
LostFocus

コントロールがフォーカスを失ったときに発生します。

(継承元 Control)
MarginChanged

コントロールのマージンが変更されたときに発生します。

(継承元 Control)
MouseCaptureChanged

コントロールがマウスのキャプチャを失うと発生します。

(継承元 Control)
MouseClick

マウスでコントロールをクリックしたときに発生します。

(継承元 Control)
MouseDoubleClick

マウスでコントロールをダブルクリックしたときに発生します。

(継承元 Control)
MouseDown

マウス ポインターがコントロール上にあり、マウス ボタンがクリックされると発生します。

(継承元 Control)
MouseEnter

マウス ポインターによってコントロールが入力されると発生します。

(継承元 Control)
MouseHover

マウス ポインターをコントロールの上に重ねると発生します。

(継承元 Control)
MouseLeave

マウス ポインターがコントロールを離れると発生します。

(継承元 Control)
MouseMove

マウス ポインターがコントロール上を移動すると発生します。

(継承元 Control)
MouseUp

マウス ポインターがコントロール上にある状態でマウス ボタンが離されると発生します。

(継承元 Control)
MouseWheel

コントロールにフォーカスがある間に、マウスのホイールを移動したときに発生します。

(継承元 Control)
Move

コントロールが移動されると発生します。

(継承元 Control)
Navigate

ユーザーが新しいテーブルに移動すると発生します。

PaddingChanged

コントロールの埋め込みが変更されたときに発生します。

(継承元 Control)
Paint

コントロールが再描画されると発生します。

(継承元 Control)
ParentChanged

Parent プロパティの値が変化すると発生します。

(継承元 Control)
ParentRowsLabelStyleChanged

親行のラベル スタイルが変更されると発生します。

ParentRowsVisibleChanged

ParentRowsVisible プロパティの値が変化すると発生します。

PreviewKeyDown

このコントロールにフォーカスがあるときにキーが押された場合、KeyDown イベントの前に発生します。

(継承元 Control)
QueryAccessibilityHelp

AccessibleObject がユーザー補助アプリケーションにヘルプを提供したときに発生します。

(継承元 Control)
QueryContinueDrag

ドラッグ アンド ドロップ操作中に発生し、ドラッグ ソースがドラッグ アンド ドロップ操作をキャンセルする必要があるかどうかを決定できるようにします。

(継承元 Control)
ReadOnlyChanged

ReadOnly プロパティの値が変化すると発生します。

RegionChanged

Region プロパティの値が変化したときに発生します。

(継承元 Control)
Resize

コントロールのサイズが変更されると発生します。

(継承元 Control)
RightToLeftChanged

RightToLeft プロパティの値が変化すると発生します。

(継承元 Control)
RowHeaderClick

行ヘッダーがクリックされると発生します。

Scroll

ユーザーが DataGrid コントロールをスクロールすると発生します。

ShowParentDetailsButtonClick

ShowParentDetails ボタンがクリックされたときに発生します。

SizeChanged

Size プロパティの値が変化すると発生します。

(継承元 Control)
StyleChanged

コントロール スタイルが変更されると発生します。

(継承元 Control)
SystemColorsChanged

システム カラーが変更されると発生します。

(継承元 Control)
TabIndexChanged

TabIndex プロパティの値が変化すると発生します。

(継承元 Control)
TabStopChanged

TabStop プロパティの値が変化すると発生します。

(継承元 Control)
TextChanged

Text プロパティの値が変化したときに発生します。

Validated

コントロールの検証が終了すると発生します。

(継承元 Control)
Validating

コントロールが検証しているときに発生します。

(継承元 Control)
VisibleChanged

Visible プロパティの値が変化すると発生します。

(継承元 Control)

明示的なインターフェイスの実装

IDropTarget.OnDragDrop(DragEventArgs)

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

(継承元 Control)
IDropTarget.OnDragEnter(DragEventArgs)

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

(継承元 Control)
IDropTarget.OnDragLeave(EventArgs)

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

(継承元 Control)
IDropTarget.OnDragOver(DragEventArgs)

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

(継承元 Control)

適用対象

こちらもご覧ください