private void SetupDGV() { dgvCommon.Columns.Clear(); dgvRare.Columns.Clear(); DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn(); { dgvIndex.HeaderText = "Index"; dgvIndex.DisplayIndex = 0; dgvIndex.Width = 45; dgvIndex.ReadOnly = true; dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } DataGridViewComboBoxColumn dgvMove = new DataGridViewComboBoxColumn(); { dgvMove.HeaderText = "Item"; dgvMove.DisplayIndex = 1; foreach (string t in itemlist) { dgvMove.Items.Add(t); // add only the Names } dgvMove.Width = 133; dgvMove.FlatStyle = FlatStyle.Flat; } dgvCommon.Columns.Add(dgvIndex); dgvCommon.Columns.Add(dgvMove); dgvRare.Columns.Add((DataGridViewColumn)dgvIndex.Clone()); dgvRare.Columns.Add((DataGridViewColumn)dgvMove.Clone()); }
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; } DataGridViewComboBoxColumn dgvMove = new DataGridViewComboBoxColumn(); { dgvMove.HeaderText = "Move"; dgvMove.DisplayIndex = 1; for (int i = 0; i < movelist.Length; i++) { dgvMove.Items.Add(movelist[i]); // add only the Names } dgvMove.Width = 133; dgvMove.FlatStyle = FlatStyle.Flat; } dgvTM.Columns.Add(dgvIndex); dgvTM.Columns.Add(dgvMove); dgvHM.Columns.Add((DataGridViewColumn)dgvIndex.Clone()); dgvHM.Columns.Add((DataGridViewColumn)dgvMove.Clone()); }
private void GenerarGrillas() { dGVc.Columns.Clear(); dGVAb.Columns.Clear(); dGVAb.Rows.Clear(); for (int i = 1; i <= int.Parse(txtNroVariables.Text); i++) { DataGridViewColumn Columna = new DataGridViewTextBoxColumn(); Columna.HeaderText = "X" + i.ToString(); Columna.Width = 100; Columna.ValueType = Type.GetType("System.Decimal"); Columna.Name = "X" + i.ToString(); dGVc.Columns.Add(Columna); DataGridViewColumn Columna2 = (DataGridViewTextBoxColumn) Columna.Clone(); dGVAb.Columns.Add(Columna2); } dGVc.Rows.Add(); //RHS DataGridViewColumn ColumnaRHS = new DataGridViewTextBoxColumn(); ColumnaRHS.HeaderText = "RHS"; ColumnaRHS.Width = 100; ColumnaRHS.ValueType = Type.GetType("System.Decimal"); ColumnaRHS.Name = "RHS"; dGVAb.Columns.Add(ColumnaRHS); dGVAb.Columns["RHS"].DefaultCellStyle.BackColor = Color.Aqua; //filas A for (int i = 1; i <= int.Parse(txtNroRestricciones.Text); i++) { dGVAb.Rows.Add(); } }
void initGrid() { //grid uiGrid.Dock = DockStyle.Fill; uiGrid.AllowUserToAddRows = false; uiGrid.AllowUserToDeleteRows = false; uiGrid.AllowUserToOrderColumns = false; uiGrid.AllowUserToResizeColumns = false; uiGrid.AllowUserToResizeRows = false; uiGrid.RowHeadersVisible = false; uiGrid.RowTemplate.Height = 40; //for (int i = 0; i < colNames.Length; i++) { var col = new DataGridViewTextBoxColumn(); col.HeaderText = colNames[0]; col.FillWeight = 6; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; col.SortMode = DataGridViewColumnSortMode.NotSortable; uiGrid.Columns.Add(col); col = (DataGridViewTextBoxColumn)col.Clone(); col.HeaderText = colNames[1]; col.FillWeight = 4; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; col.DefaultCellStyle.Padding = new Padding(0, 0, 10, 0); col.DefaultCellStyle.ForeColor = System.Drawing.Color.DodgerBlue; col.DefaultCellStyle.Font = new System.Drawing.Font("Consolas", 12); uiGrid.Columns.Add(col); } uiGrid.Rows.Add(new object[] { "X Range", mRangeX }); uiGrid.Rows.Add(new object[] { "Y Range", mRangeY }); uiGrid.Rows.Add(new object[] { "Num Steps", mSteps }); }
public 订单管理Form() { InitializeComponent(); #region 初始化当前订单显示 //禁止自动生成列 nowOrderDataView.AutoGenerateColumns = false; //创建网格控件列 DataGridViewTextBoxColumn colCname = new DataGridViewTextBoxColumn(); colCname.HeaderText = "顾客姓名"; colCname.DataPropertyName = "Cname"; nowOrderDataView.Columns.Add(colCname); DataGridViewTextBoxColumn colCtellphone = new DataGridViewTextBoxColumn(); colCtellphone.HeaderText = "联系方式"; colCtellphone.DataPropertyName = "Ctellphone"; nowOrderDataView.Columns.Add(colCtellphone); DataGridViewTextBoxColumn colDid = new DataGridViewTextBoxColumn(); colDid.HeaderText = "餐桌号"; colDid.DataPropertyName = "Did"; nowOrderDataView.Columns.Add(colDid); DataGridViewTextBoxColumn colOrdernum = new DataGridViewTextBoxColumn(); colOrdernum.HeaderText = "订单号"; colOrdernum.DataPropertyName = "Ordernum"; nowOrderDataView.Columns.Add(colOrdernum); DataGridViewTextBoxColumn colIfcheckout = new DataGridViewTextBoxColumn(); colIfcheckout.HeaderText = "是否已结账"; colIfcheckout.DataPropertyName = "Ifcheckout"; nowOrderDataView.Columns.Add(colIfcheckout); DataGridViewTextBoxColumn colOrdermoney = new DataGridViewTextBoxColumn(); colOrdermoney.HeaderText = "订单价格"; colOrdermoney.DataPropertyName = "Ordermoney"; nowOrderDataView.Columns.Add(colOrdermoney); #endregion #region 初始化历史订单显示 //禁止自动生成列 historyOrderDataView.AutoGenerateColumns = false; //创建网格控件列 DataGridViewTextBoxColumn colCname1 = (DataGridViewTextBoxColumn)colCname.Clone(); historyOrderDataView.Columns.Add(colCname1); DataGridViewTextBoxColumn colCtellphone1 = (DataGridViewTextBoxColumn)colCtellphone.Clone(); historyOrderDataView.Columns.Add(colCtellphone1); DataGridViewTextBoxColumn colOrderdate = new DataGridViewTextBoxColumn(); colOrderdate.HeaderText = "订单日期"; colOrderdate.DataPropertyName = "Orderdate"; historyOrderDataView.Columns.Add(colOrderdate); DataGridViewTextBoxColumn colOrdernum1 = (DataGridViewTextBoxColumn)colOrdernum.Clone(); historyOrderDataView.Columns.Add(colOrdernum1); DataGridViewTextBoxColumn colOrdermoney1 = (DataGridViewTextBoxColumn)colOrdermoney.Clone(); historyOrderDataView.Columns.Add(colOrdermoney1); #endregion }