本文整理汇总了C#中System.Windows.Forms.DataGridViewComboBoxColumn.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewComboBoxColumn.Clone方法的具体用法?C# DataGridViewComboBoxColumn.Clone怎么用?C# DataGridViewComboBoxColumn.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridViewComboBoxColumn
的用法示例。
在下文中一共展示了DataGridViewComboBoxColumn.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form_AddRoom
public Form_AddRoom(List<Room> rooms)
{
InitializeComponent();
_rooms = rooms;
comboBox_TypeRoom.DataSource = WorkWithDatabase.GetAllTypeRooms();
comboBox_typeRadiator.DataSource = WorkWithDatabase.GetAllTypeRadiator();
//материал
DataGridViewComboBoxColumn dgwCB = new DataGridViewComboBoxColumn();
dgwCB.ValueMember = "Name";
dgwCB.HeaderText = "Материал";
dgwCB.Width = 200;
dgwCB.DataSource = WorkWithDatabase.GetAllMaterials();
dataGridView_wall.Columns.Add(dgwCB);
dataGridView_door.Columns.Add((DataGridViewComboBoxColumn)dgwCB.Clone());
dataGridView_floor.Columns.Add((DataGridViewComboBoxColumn)dgwCB.Clone());
dataGridView_ceiling.Columns.Add((DataGridViewComboBoxColumn)dgwCB.Clone());
//стеклопакет
DataGridViewComboBoxColumn dgwCB2 = new DataGridViewComboBoxColumn();
dgwCB2.ValueMember = "Name";
dgwCB2.HeaderText = "Стеклопакет";
dgwCB2.Width = 130;
dgwCB2.DataSource = WorkWithDatabase.GetAllGlazedes();
dataGridView_windows.Columns.Add(dgwCB2);
//площадь профиля
DataGridViewTextBoxColumn dgwTB = new DataGridViewTextBoxColumn();
dgwTB.HeaderText = "Профиль (площадь)";
dgwTB.Width = 70;
dataGridView_windows.Columns.Add(dgwTB);
//количество камер
DataGridViewComboBoxColumn dgwCB1 = new DataGridViewComboBoxColumn();
dgwCB1.ValueMember = "CountCameras";
dgwCB1.HeaderText = "Количество камер";
dgwCB1.Width = 70;
dgwCB1.DataSource = WorkWithDatabase.GetAllWindowProfilesCountCameras();
dataGridView_windows.Columns.Add(dgwCB1);
//толщина
DataGridViewComboBoxColumn dgwCB4 = new DataGridViewComboBoxColumn();
dgwCB4.ValueMember = "Thickness";
dgwCB4.HeaderText = "Толщина";
dgwCB4.Width = 70;
dgwCB4.DataSource = WorkWithDatabase.GetAllWindowProfilesThickness();
dataGridView_windows.Columns.Add(dgwCB4);
}
示例2: setupDGV
private void setupDGV()
{
dgvTM.Columns.Clear(); dgvHM.Columns.Clear();
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
{
dgvIndex.HeaderText = "Index";
dgvIndex.DisplayIndex = 0;
dgvIndex.Width = 45;
dgvIndex.ReadOnly = true;
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dgvIndex.SortMode = DataGridViewColumnSortMode.NotSortable;
}
DataGridViewComboBoxColumn dgvMove = new DataGridViewComboBoxColumn();
{
dgvMove.HeaderText = "Move";
dgvMove.DisplayIndex = 1;
foreach (string t in movelist)
dgvMove.Items.Add(t); // add only the Names
dgvMove.Width = 133;
dgvMove.FlatStyle = FlatStyle.Flat;
dgvIndex.SortMode = DataGridViewColumnSortMode.NotSortable;
}
dgvTM.Columns.Add(dgvIndex);
dgvTM.Columns.Add(dgvMove);
dgvHM.Columns.Add((DataGridViewColumn)dgvIndex.Clone());
dgvHM.Columns.Add((DataGridViewColumn)dgvMove.Clone());
}
示例3: TableLoad
/* Загрузка данных */
private void TableLoad()
{
_dataSet.Clear();
_dataSet.DataSetName = "spectacle";
_sqlServer.SelectSqlCommand = "SELECT * FROM spectacle";
_sqlServer.InsertSqlCommand = "INSERT INTO spectacle (spectacle_name, spectacle_genre, spectacle_author, spectacle_director, spectacle_producer, spectacle_designer, spectacle_conductor)" +
" VALUES (@spectacle_name, @spectacle_genre, @spectacle_author, @spectacle_director, @spectacle_producer, @spectacle_designer, @spectacle_conductor)";
_sqlServer.InsertParametersAdd("@spectacle_name", SqlDbType.VarChar, 255, "spectacle_name");
_sqlServer.InsertParametersAdd("@spectacle_genre", SqlDbType.VarChar, 50, "spectacle_genre");
_sqlServer.InsertParametersAdd("@spectacle_author", SqlDbType.Int, 11, "spectacle_author");
_sqlServer.InsertParametersAdd("@spectacle_director", SqlDbType.Int, 11, "spectacle_director");
_sqlServer.InsertParametersAdd("@spectacle_producer", SqlDbType.Int, 11, "spectacle_producer");
_sqlServer.InsertParametersAdd("@spectacle_designer", SqlDbType.Int, 11, "spectacle_designer");
_sqlServer.InsertParametersAdd("@spectacle_conductor", SqlDbType.Int, 11, "spectacle_conductor");
_sqlServer.InsertParametersAdd("@spectacle_id", SqlDbType.Int, 11, "spectacle_id");
_sqlServer.UpdateSqlCommand = "UPDATE spectacle SET spectacle_name = @spectacle_name, spectacle_genre = @spectacle_genre, spectacle_author = @spectacle_author, spectacle_director = @spectacle_director, spectacle_producer = @spectacle_producer, spectacle_designer = @spectacle_designer, spectacle_conductor = @spectacle_conductor WHERE (spectacle_id = @spectacle_id)";
_sqlServer.UpdateParametersAdd("@spectacle_name", SqlDbType.VarChar, 255, "spectacle_name");
_sqlServer.UpdateParametersAdd("@spectacle_genre", SqlDbType.VarChar, 50, "spectacle_genre");
_sqlServer.UpdateParametersAdd("@spectacle_author", SqlDbType.Int, 11, "spectacle_author");
_sqlServer.UpdateParametersAdd("@spectacle_director", SqlDbType.Int, 11, "spectacle_director");
_sqlServer.UpdateParametersAdd("@spectacle_producer", SqlDbType.Int, 11, "spectacle_producer");
_sqlServer.UpdateParametersAdd("@spectacle_designer", SqlDbType.Int, 11, "spectacle_designer");
_sqlServer.UpdateParametersAdd("@spectacle_conductor", SqlDbType.Int, 11, "spectacle_conductor");
_sqlServer.UpdateParametersAdd("@spectacle_id", SqlDbType.Int, 11, "spectacle_id");
_sqlServer.DeleteSqlCommand = "DELETE FROM spectacle WHERE (spectacle_id = @spectacle_id)";
_sqlServer.DeleteParametersAdd("@spectacle_id", SqlDbType.Int, 11, "spectacle_id");
if (_sqlServer.ExecuteFill(_dataSet, "spectacle"))
{
_bindingSource.DataSource = _dataSet;
_bindingSource.DataMember = "spectacle";
bindingNavigator1.BindingSource = _bindingSource;
dataGridView1.DataSource = _bindingSource;
}
/* Загрузка списка идентификаторов всех авторов */
DataGridViewComboBoxColumn cBox1 = new DataGridViewComboBoxColumn();
_dataSetAuthor.Clear();
_dataSetAuthor.DataSetName = "author";
_sqlServer2.SelectSqlCommand = "SELECT * FROM author";
if (_sqlServer2.ExecuteFill(_dataSetAuthor, "author"))
{
foreach (DataRow row in _dataSetAuthor.Tables["author"].Rows)
{
cBox1.Items.Add(row["author_id"]);
}
}
cBox1.HeaderText = "Автор ID";
cBox1.DataPropertyName = "spectacle_author";
cBox1.Width = 150;
dataGridView1.Columns.Add(cBox1);
/* Загрузка списка идентификаторов всех работников театра */
DataGridViewComboBoxColumn cBox2 = new DataGridViewComboBoxColumn();
_dataSetStaff.Clear();
_dataSetStaff.DataSetName = "employee";
_sqlServer2.SelectSqlCommand = "SELECT * FROM employee";
if (_sqlServer2.ExecuteFill(_dataSetStaff, "employee"))
{
foreach (DataRow row in _dataSetStaff.Tables["employee"].Rows)
{
cBox2.Items.Add(row["employee_id"]);
}
}
cBox2.HeaderText = "Постановщик ID";
cBox2.DataPropertyName = "spectacle_director";
cBox2.Width = 150;
dataGridView1.Columns.Add(cBox2);
DataGridViewComboBoxColumn cBox3 = new DataGridViewComboBoxColumn();
cBox3 = (DataGridViewComboBoxColumn)cBox2.Clone();
cBox3.HeaderText = "Режиссер-постановщик ID";
cBox3.DataPropertyName = "spectacle_producer";
cBox3.Width = 150;
dataGridView1.Columns.Add(cBox3);
DataGridViewComboBoxColumn cBox4 = new DataGridViewComboBoxColumn();
cBox4 = (DataGridViewComboBoxColumn)cBox2.Clone();
cBox4.HeaderText = "Художник-постановщик ID";
cBox4.DataPropertyName = "spectacle_designer";
cBox4.Width = 150;
dataGridView1.Columns.Add(cBox4);
DataGridViewComboBoxColumn cBox5 = new DataGridViewComboBoxColumn();
cBox5 = (DataGridViewComboBoxColumn)cBox2.Clone();
cBox5.HeaderText = "Дирижер ID";
cBox5.DataPropertyName = "spectacle_conductor";
cBox5.Width = 150;
dataGridView1.Columns.Add(cBox5);
}