本文整理汇总了C#中System.Windows.Forms.DataGridViewTextBoxColumn.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewTextBoxColumn.Clone方法的具体用法?C# DataGridViewTextBoxColumn.Clone怎么用?C# DataGridViewTextBoxColumn.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridViewTextBoxColumn
的用法示例。
在下文中一共展示了DataGridViewTextBoxColumn.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TfMain
public TfMain(int orderId, string connectionString)
{
InitializeComponent();
TfMain.OrderId = orderId;
LocalService.ConnectionString = connectionString;
DataTable tbOrder = LocalService.GetOrderInfo(orderId).Tables[0];
if (tbOrder.Rows.Count <= 0)
{
MessageBox.Show("Данного заказа не существует. Приложение будет закрыто!", "Внимание",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
TfMain.IsClose = true;
return;
}
DataRow rwOrder = tbOrder.Rows[0];
OrderType = Convert.ToInt32(rwOrder["Код типа гнутия"]);
CorniceType = Convert.ToInt32(rwOrder["Код типа карниза"]);
dsSplints.Clear();
dsSplints.tbComponents.Load(LocalService.GetSplintComponents().Tables[0].CreateDataReader());
dsSplints.tbContour.Load(LocalService.GetSplintContour().Tables[0].CreateDataReader());
dsLines.tbLine.Clear();
dsLines.tbLine.Load(LocalService.GetLinesList(orderId).Tables[0].CreateDataReader());
foreach (dsLines.tbLineRow rwl in dsLines.tbLine.Rows)
{
DataColumn cl = new DataColumn(rwl.Номер_линии.ToString(), typeof(double));
cl.DefaultValue = rwl.Отлет;
dsLines.tbWallClearance.Columns.Add(cl);
DataGridViewTextBoxColumn dbgcol = new DataGridViewTextBoxColumn();
dbgcol.DataPropertyName = rwl.Номер_линии.ToString();
dbgcol.HeaderText = rwl.Номер_линии.ToString();
dbgcol.Width = 80;
dbgcol.DefaultCellStyle.Format = "N3";
dbgcol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dbgcol.ReadOnly = false;
dbgClearance.Columns.Add(dbgcol);
dbgClearanceCurve.Columns.Add(dbgcol.Clone() as DataGridViewTextBoxColumn);
}
tb.TabStop = false;
tb.SizeMode = TabSizeMode.Fixed;
tb.Appearance = TabAppearance.FlatButtons;
tb.ItemSize = new Size(0, 1);
Text = $"График карниза (Заказ №{orderId:G})";
if (LocalService.OrderState(orderId) != 0)
{
btRLine.Enabled = false;
btSave.Enabled = false;
btWallToLine.Enabled = false;
tbWall.Enabled = false;
tbPicture.Enabled = false;
Text += " - только просмотр";
}
if (!LocalService.IsWallExists(orderId))
return;
try
{
dsWall.tbWall.Load(LocalService.GetWallList(orderId).Tables[0].CreateDataReader());
dsWall.tbWallDetail.Load(LocalService.GetWallDetail(orderId).Tables[0].CreateDataReader());
dsWall.AcceptChanges();
int i = 0;
foreach (dsWall.tbWallRow rww in dsWall.tbWall)
{
dsWall.tbWallSegmentRow rws;
if (Math.Abs(rww.Угол) > 0.001)
{
rws = (dsWall.tbWallSegmentRow)dsWall.tbWallSegment.NewRow();
rws.Длина = 0;
rws.Угол = rww.Угол;
rws.Номер = ++i;
dsWall.tbWallSegment.Rows.Add(rws);
dsWall.tbWallSegment.AcceptChanges();
rww.Код_сегмента = rws.Код;
}
foreach (dsWall.tbWallDetailRow rwwd in dsWall.tbWallDetail.Select
("[Код стены]=" + rww.Код.ToString()))
{
rws = (dsWall.tbWallSegmentRow)dsWall.tbWallSegment.NewRow();
rws.Длина = rwwd.Длина;
rws.Угол = rwwd.Угол;
rws.Номер = ++i;
dsWall.tbWallSegment.Rows.Add(rws);
dsWall.tbWallSegment.AcceptChanges();
rwwd.Код_сегмента = rws.Код;
}
}
dsWall.tbAgregate.Load(LocalService.GetAgregate(orderId).Tables[0].CreateDataReader());
dsWall.tbMeasure.Load(LocalService.GetMeasure(orderId).Tables[0].CreateDataReader());
//.........这里部分代码省略.........
示例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());
}