當前位置: 首頁>>代碼示例>>C#>>正文


C# DataGridViewColumn.Clone方法代碼示例

本文整理匯總了C#中System.Windows.Forms.DataGridViewColumn.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# DataGridViewColumn.Clone方法的具體用法?C# DataGridViewColumn.Clone怎麽用?C# DataGridViewColumn.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.DataGridViewColumn的用法示例。


在下文中一共展示了DataGridViewColumn.Clone方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Form1

	public Form1() {
		//this.AutoSize = true;
		DataGridView dgv = new DataGridView();
		//dgv.Size = new Size(500,250);
		dgv.Location = new Point(10,10);
		dgv.RowTemplate = new DataGridViewRow();
		DataGridViewColumn col = new DataGridViewColumn();
		col.CellTemplate = new DataGridViewTextBoxCell();
		dgv.Columns.Add(col.Clone() as DataGridViewColumn);
		dgv.Columns.Add(col.Clone() as DataGridViewColumn);
		dgv.Columns.Add(col.Clone() as DataGridViewColumn);
		dgv.RowCount = 4;
		dgv.EnableHeadersVisualStyles = false;
		dgv.AutoSize = true;
		this.Controls.Add(dgv);
		this.Text = "DataGridView advanced border styles demo";
	}
開發者ID:hitswa,項目名稱:winforms,代碼行數:17,代碼來源:SimpleTest.cs

示例2: Form1

	public Form1() {
		//this.AutoSize = true;
		dgv = new DataGridView();
		Console.WriteLine("AdvancedCellBorderStyle: " + dgv.AdvancedCellBorderStyle.ToString());
		//dgv.Size = new Size(500,250);
		dgv.Location = new Point(10,10);
		dgv.RowTemplate = new DataGridViewRow();
		DataGridViewColumn col = new DataGridViewColumn();
		col.CellTemplate = new DataGridViewTextBoxCell();
		dgv.Columns.Add(col);
		DataGridViewColumn col2 = col.Clone() as DataGridViewColumn;
		col2.CellTemplate = col.CellTemplate;
		dgv.Columns.Add(col2);
		DataGridViewColumn col3 = col.Clone() as DataGridViewColumn;
		col3.CellTemplate = col.CellTemplate;
		dgv.Columns.Add(col3);
		dgv.RowCount = 4;
		dgv.EnableHeadersVisualStyles = false;
		dgv.AutoSize = true;
		dgv.CellPainting += OnCellPainting;
		this.Controls.Add(dgv);
		this.Text = "DataGridView advanced border styles demo";
	}
開發者ID:hitswa,項目名稱:winforms,代碼行數:23,代碼來源:SimpleTest2.cs

示例3: SetTotalColumns

 //合計列的位置對應
 private void SetTotalColumns(DataGridViewColumn col)
 {
     bool b_Col = false;
     DataGridViewColumn newcol = new DataGridViewColumn();
     newcol = (DataGridViewColumn)col.Clone();
     newcol.DisplayIndex = col.DisplayIndex;
     newcol.Visible = col.Visible;
     foreach (DataGridViewColumn d_co in botTotal.Columns)
     {
         if (d_co.Name == newcol.Name)
         {
             b_Col = true;
             break;
         }
     }
     if (b_Col)
     {
         botTotal.Columns.Remove(newcol.Name);
     }
     //newcol.HeaderText = newcol.Name;
     if (newcol.Name != "")
     {
         System.Windows.Forms.DataGridViewTextBoxColumn ColNew = new DataGridViewTextBoxColumn();
         ColNew.Name = newcol.Name;
         ColNew.DisplayIndex = newcol.DisplayIndex;
         ColNew.Visible = newcol.Visible;
         ColNew.DataPropertyName = newcol.DataPropertyName;
         botTotal.Columns.Add(ColNew);
         //botTotal.Columns.Add(newcol);
     }
 }
開發者ID:wuyanqing,項目名稱:wc001,代碼行數:32,代碼來源:DataGridView.cs


注:本文中的System.Windows.Forms.DataGridViewColumn.Clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。