/**/
///NewDataGrid
// form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using XUIControls;
namespace NewDataGrid
... {
public partial class Form1 : Form
...{
// private XUIControls.DataGridComboBoxColumnStyle userhead;
private System.Windows.Forms.DataGrid dataGrid1;
XUIControls.DataGridCheckBoxColumnStyle chkStyle;
DataGridTextBoxColumn nameColumnStyle;
private DataTable namesDataTable;
public Form1()
...{
InitializeComponent();
namesDataTable = new DataTable("NamesTable");
dataGrid1.Enabled = true;
namesDataTable.Columns.Add(new DataColumn("Name"));
namesDataTable.Columns.Add(new DataColumn("State"));
namesDataTable.Columns.Add(new DataColumn("Date"));
DataSet namesDataSet = new DataSet();
namesDataSet.Tables.Add(namesDataTable);
AddData();
// MessageBox.Show("Fgshf");
this.dataGrid1.DataSource = namesDataSet;
this.dataGrid1.DataMember = "NamesTable";
AddGridStyle();
}
private void AddData()
...{
DataRow dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 1";
dRow["State"] = "xxx";
dRow["Date"] = "Y";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 2";
dRow["Date"] = "Y";
dRow["State"] = "xxx";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 3";
dRow["State"] = "xxx";
dRow["Date"] = "N";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 4";
dRow["State"] = "xxx";
dRow["Date"] ="N";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 5";
dRow["State"] = "xxx";
dRow["Date"] = "Y";
namesDataTable.Rows.Add(dRow);
namesDataTable.AcceptChanges();
}
private void AddGridStyle()
...{
DataGridTableStyle myGridStyle = new DataGridTableStyle();
myGridStyle.MappingName = "NamesTable";
nameColumnStyle =
new DataGridTextBoxColumn();
nameColumnStyle.MappingName = "Name";
nameColumnStyle.HeaderText = "Name";
myGridStyle.GridColumnStyles.Add(nameColumnStyle);
XUIControls.DataGridComboBoxColumnStyle cmbStyle = new XUIControls.DataGridComboBoxColumnStyle();
cmbStyle.MappingName = "State";
cmbStyle.HeaderText = "State";
cmbStyle.Width = 100;
cmbStyle.AddItem("xxx");
cmbStyle.AddItem("1111");
myGridStyle.GridColumnStyles.Add(cmbStyle);
chkStyle = new XUIControls.DataGridCheckBoxColumnStyle();
chkStyle.MappingName = "Date";
chkStyle.HeaderText = "Date";
cmbStyle.Width = 100;
myGridStyle.GridColumnStyles.Add(chkStyle);
this.dataGrid1.TableStyles.Add(myGridStyle);
}
private void button1_Click(object sender, EventArgs e)
...{
MessageBox.Show(nameColumnStyle.TextBox.Text);
//if (chkStyle.)
/**//// MessageBox.Show("GDFG");
// else
// MessageBox.Show("hhh");
}
}
}
// form1.designer.cs
namespace NewDataGrid
// form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using XUIControls;
namespace NewDataGrid
... {
public partial class Form1 : Form
...{
// private XUIControls.DataGridComboBoxColumnStyle userhead;
private System.Windows.Forms.DataGrid dataGrid1;
XUIControls.DataGridCheckBoxColumnStyle chkStyle;
DataGridTextBoxColumn nameColumnStyle;
private DataTable namesDataTable;
public Form1()
...{
InitializeComponent();
namesDataTable = new DataTable("NamesTable");
dataGrid1.Enabled = true;
namesDataTable.Columns.Add(new DataColumn("Name"));
namesDataTable.Columns.Add(new DataColumn("State"));
namesDataTable.Columns.Add(new DataColumn("Date"));
DataSet namesDataSet = new DataSet();
namesDataSet.Tables.Add(namesDataTable);
AddData();
// MessageBox.Show("Fgshf");
this.dataGrid1.DataSource = namesDataSet;
this.dataGrid1.DataMember = "NamesTable";
AddGridStyle();
}
private void AddData()
...{
DataRow dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 1";
dRow["State"] = "xxx";
dRow["Date"] = "Y";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 2";
dRow["Date"] = "Y";
dRow["State"] = "xxx";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 3";
dRow["State"] = "xxx";
dRow["Date"] = "N";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 4";
dRow["State"] = "xxx";
dRow["Date"] ="N";
namesDataTable.Rows.Add(dRow);
dRow = namesDataTable.NewRow();
dRow["Name"] = "Name 5";
dRow["State"] = "xxx";
dRow["Date"] = "Y";
namesDataTable.Rows.Add(dRow);
namesDataTable.AcceptChanges();
}
private void AddGridStyle()
...{
DataGridTableStyle myGridStyle = new DataGridTableStyle();
myGridStyle.MappingName = "NamesTable";
nameColumnStyle =
new DataGridTextBoxColumn();
nameColumnStyle.MappingName = "Name";
nameColumnStyle.HeaderText = "Name";
myGridStyle.GridColumnStyles.Add(nameColumnStyle);
XUIControls.DataGridComboBoxColumnStyle cmbStyle = new XUIControls.DataGridComboBoxColumnStyle();
cmbStyle.MappingName = "State";
cmbStyle.HeaderText = "State";
cmbStyle.Width = 100;
cmbStyle.AddItem("xxx");
cmbStyle.AddItem("1111");
myGridStyle.GridColumnStyles.Add(cmbStyle);
chkStyle = new XUIControls.DataGridCheckBoxColumnStyle();
chkStyle.MappingName = "Date";
chkStyle.HeaderText = "Date";
cmbStyle.Width = 100;
myGridStyle.GridColumnStyles.Add(chkStyle);
this.dataGrid1.TableStyles.Add(myGridStyle);
}
private void button1_Click(object sender, EventArgs e)
...{
MessageBox.Show(nameColumnStyle.TextBox.Text);
//if (chkStyle.)
/**//// MessageBox.Show("GDFG");
// else
// MessageBox.Show("hhh");
}
}
}
// form1.designer.cs
namespace NewDataGrid