本文整理汇总了C#中System.Windows.Forms.DataGridViewColumn类的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewColumn类的具体用法?C# DataGridViewColumn怎么用?C# DataGridViewColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridViewColumn类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewColumn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateEmptyGrid
void CreateEmptyGrid()
{
m_Grid = new DataGridView();
m_Grid.ReadOnly = true;
m_Grid.Parent = this;
m_Grid.Dock = DockStyle.Fill;
m_Table = new DataTable();
m_Grid.DataSource = m_Table;
//Add base item attributes
Type ItemType = typeof(GameplayItem);
Type ItemAttrType = typeof(ItemAttributes);
System.Reflection.FieldInfo[] ItemFields = ItemType.GetFields();
System.Reflection.FieldInfo[] ItemAttrFields = ItemAttrType.GetFields();
List<string> FieldNames = new List<string>();
foreach (System.Reflection.FieldInfo Info in ItemFields)
{
FieldNames.Add(Info.Name);
DataGridViewColumn Col = new DataGridViewColumn(CreateCellTemplate(Info));
Col.Name = Info.Name;
//m_Grid.Columns.Add(Col);
m_Table.Columns.Add(Info.Name, Info.FieldType);
}
foreach (System.Reflection.FieldInfo Info in ItemAttrFields)
{
FieldNames.Add(Info.Name);
DataGridViewColumn Col = new DataGridViewColumn(CreateCellTemplate(Info));
Col.Name = Info.Name;
//m_Grid.Columns.Add(Col);
m_Table.Columns.Add(Info.Name, Info.FieldType);
}
}
开发者ID:przemyslaw-szymanski,项目名称:dungeonworld,代码行数:35,代码来源:CItemGrid.cs
示例2: _btnSelect_Click
private void _btnSelect_Click(object sender, EventArgs e)
{
foreach (string cl in _clbShowColumn.CheckedItems)
{
DataGridViewColumn _column = new DataGridViewColumn();
_column.CellTemplate = new DataGridViewTextBoxCell();
_column.Name = cl;
_column.HeaderText = cl;
_column.DataPropertyName = cl;
_column.SortMode = DataGridViewColumnSortMode.Automatic;
switch(_InsertionType)
{
case InsertionType.Before :
_Grid.Columns.Insert(_ColumnPosition, _column);
break;
case InsertionType.After :
_Grid.Columns.Insert(_ColumnPosition + 1, _column);
break;
}
}
this.Close();
}
开发者ID:masalinas,项目名称:konekti.net,代码行数:25,代码来源:ColumnFilterForm.cs
示例3: GetColumnText
string GetColumnText(DataGridViewColumn column)
{
if (column.HeaderText == "" && column is DataGridViewButtonColumn)
return ((DataGridViewButtonColumn)column).Text;
return column.HeaderText;
}
开发者ID:atan888,项目名称:MMS,代码行数:7,代码来源:ExtendedDataGridView.ContextMenu.cs
示例4: GetColunas
public override DataGridViewColumn[] GetColunas()
{
var colunas = new DataGridViewColumn[]
{
new DataGridViewTextBoxColumn
{
DataPropertyName = "Id",
HeaderText = "Id",
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Descricao",
HeaderText = "Descricao"
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Valor",
HeaderText = "Valor"
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Categoria",
HeaderText = "Categoria"
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Cliente",
HeaderText = "Cliente"
}
};
return colunas;
}
开发者ID:FilipeAndrade,项目名称:ePomar,代码行数:33,代码来源:ReceitaControl.cs
示例5: data_grid
public static void data_grid(DataGridView dgv_grid)
{
dgv_grid.AutoGenerateColumns = true;
DataGridViewCell Cell_1 = new DataGridViewTextBoxCell();
DataGridViewCell Cell_2 = new DataGridViewTextBoxCell();
DataGridViewCell Cell_3 = new DataGridViewTextBoxCell();
DataGridViewColumn col__from = new DataGridViewColumn();
DataGridViewColumn col__to = new DataGridViewColumn();
DataGridViewColumn col__length = new DataGridViewColumn();
col__from.HeaderText = "Откуда";
col__to.HeaderText = "Куда";
col__length.HeaderText = "Длина";
col__from.Width = 110;
col__to.Width = 110;
col__length.Width = 110;
col__from.CellTemplate = Cell_1;
col__to.CellTemplate = Cell_2;
col__length.CellTemplate = Cell_3;
dgv_grid.ReadOnly = false;
dgv_grid.AllowUserToAddRows = true;
dgv_grid.AllowUserToDeleteRows = true;
dgv_grid.Columns.Add(col__from);
dgv_grid.Columns.Add(col__to);
dgv_grid.Columns.Add(col__length);
}
开发者ID:Zarettiii,项目名称:ant_algorithm,代码行数:31,代码来源:c__data_grids.cs
示例6: DataGridViewColumnSpec
public DataGridViewColumnSpec(DataGridViewColumn column, Color backColor, Image image, bool useImage) : this(column, image)
{
Column = column;
this.Image = image;
BackColor = backColor;
UseImage = useImage;
}
开发者ID:ChineduOpara,项目名称:KCS.Common.Windows,代码行数:7,代码来源:DataGridViewColumnEx.cs
示例7: AFN
public AFN(ArrayList transicio,string[] estadosA,string []sim, string [] esta, string ini)
{
InitializeComponent();
transiciones = transicio;
estadosAceptacion=estadosA;
simbolos=sim;
estados=esta;
inicio=ini;
for(int a=0;a<simbolos.Length;a++)
{
DataGridViewColumn columna = new DataGridViewColumn(new DataGridViewTextBoxCell());
columna.Name = (string)simbolos[a];
columna.Width = 30;
dataGridView1.Columns.Add(columna);
}
DataGridViewColumn columnaf = new DataGridViewColumn(new DataGridViewTextBoxCell());
columnaf.Name = "F";
dataGridView1.Columns.Add(columnaf);
for (int b = 0; b < estados.Length; b++)
{
dataGridView1.Rows.Add();
dataGridView1["QΣ", b].Value = estados[b];
}
agregarDatos();
}
开发者ID:urcuqui,项目名称:AFN-a-AFD,代码行数:30,代码来源:AFN.cs
示例8: TableForm
public TableForm(string name, IDataReader rdr)
{
DataGridView dgv = new DataGridView();
dgv.Dock = DockStyle.Fill;
DataGridViewTextBoxCell template = new DataGridViewTextBoxCell();
template.Style.Font = new Font("DejaVu Sans",10);
for (int i = 0;i < rdr.FieldCount;i++)
{
DataGridViewColumn col = new DataGridViewColumn(template);
col.Name = rdr.GetName(i);
dgv.Columns.Add(col);
}
while (rdr.Read())
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(dgv);
for (int i = 0;i < rdr.FieldCount;i++)
{
object val = rdr[i];
if (val is byte[])
{
val = Encoding.UTF8.GetString((byte[])val);
}
row.Cells[i].Value = val;
}
dgv.Rows.Add(row);
}
Controls.Add(dgv);
}
开发者ID:Upliner,项目名称:XFormTrans,代码行数:30,代码来源:TableForm.cs
示例9: SetColumnToDateFormat
public void SetColumnToDateFormat(DataGridViewColumn column, string format)
{
column.DefaultCellStyle = new DataGridViewCellStyle
{
Format = format
};
}
开发者ID:evelasco85,项目名称:TimeTracker,代码行数:7,代码来源:DataGridHelper.cs
示例10: CheckBoxColumnHeaderHandler
/// ------------------------------------------------------------------------------------
/// <summary>
/// Constructor.
/// </summary>
/// ------------------------------------------------------------------------------------
public CheckBoxColumnHeaderHandler(DataGridViewColumn col)
{
Debug.Assert(col != null);
Debug.Assert(col is DataGridViewCheckBoxColumn);
Debug.Assert(col.DataGridView != null);
m_col = col;
m_grid = col.DataGridView;
m_grid.HandleDestroyed += HandleHandleDestroyed;
m_grid.CellPainting += HandleHeaderCellPainting;
m_grid.CellMouseMove += HandleHeaderCellMouseMove;
m_grid.ColumnHeaderMouseClick += HandleHeaderCellMouseClick;
m_grid.CellContentClick += HandleDataCellCellContentClick;
m_grid.Scroll += HandleGridScroll;
m_grid.RowsAdded += HandleGridRowsAdded;
m_grid.RowsRemoved += HandleGridRowsRemoved;
if (!Application.RenderWithVisualStyles)
{
m_szCheckBox = new Size(13, 13);
}
else
{
var element = VisualStyleElement.Button.CheckBox.CheckedNormal;
var renderer = new VisualStyleRenderer(element);
using (var g = m_grid.CreateGraphics())
m_szCheckBox = renderer.GetPartSize(g, ThemeSizeType.True);
}
m_stringFormat = new StringFormat(StringFormat.GenericTypographic);
m_stringFormat.Alignment = StringAlignment.Center;
m_stringFormat.LineAlignment = StringAlignment.Center;
m_stringFormat.Trimming = StringTrimming.EllipsisCharacter;
m_stringFormat.FormatFlags |= StringFormatFlags.NoWrap;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:40,代码来源:CheckBoxColumnHeaderHandler.cs
示例11: InitialDataGridView
public void InitialDataGridView()
{
dataGridView.Rows.Clear();
dataGridView.Columns.Clear();
DataGridViewCell textCell = new DataGridViewTextBoxCell();
DataGridViewColumn timeColumn = new DataGridViewColumn();
timeColumn.HeaderText = "记录时间";
timeColumn.Width = 160;
timeColumn.CellTemplate = textCell;
DataGridViewColumn ipColumn = new DataGridViewColumn();
ipColumn.HeaderText = "IP地址";
ipColumn.Width = 120;
ipColumn.CellTemplate = textCell;
DataGridViewColumn portColumn = new DataGridViewColumn();
portColumn.HeaderText = "端口号";
portColumn.Width = 80;
portColumn.CellTemplate = textCell;
DataGridViewColumn statusColumn = new DataGridViewColumn();
statusColumn.HeaderText = "工作状态";
statusColumn.Width = 180;
statusColumn.CellTemplate = textCell;
dataGridView.Columns.Add(timeColumn);
dataGridView.Columns.Add(ipColumn);
dataGridView.Columns.Add(portColumn);
dataGridView.Columns.Add(statusColumn);
}
开发者ID:southpolaris,项目名称:EMDRepository,代码行数:27,代码来源:ConnectionForm.cs
示例12: AddTimestampColumns
private void AddTimestampColumns()
{
DataGridViewCell cell = new DataGridViewTextBoxCell();
DataGridViewColumn column = new DataGridViewColumn();
column.HeaderText = "Total Hours";
column.Name = "TotalHours";
column.CellTemplate = cell;
column.ReadOnly = true;
this.gridTimestamps.Columns.Add( column );
cell = new DataGridViewTextBoxCell();
column = new DataGridViewColumn();
column.HeaderText = "Hourly Rate";
column.Name = "HourlyRate";
column.CellTemplate = cell;
column.ReadOnly = true;
this.gridTimestamps.Columns.Add( column );
cell = new DataGridViewTextBoxCell();
column = new DataGridViewColumn();
column.HeaderText = "Amount";
column.Name = "Amount";
column.CellTemplate = cell;
column.ReadOnly = true;
this.gridTimestamps.Columns.Add( column );
}
开发者ID:mtrainham,项目名称:mjt-PoolTime,代码行数:32,代码来源:ViewPlayerForm.cs
示例13: GetColunas
public override DataGridViewColumn[] GetColunas()
{
var colunas = new DataGridViewColumn[]
{
new DataGridViewTextBoxColumn
{
DataPropertyName = "Id",
HeaderText = "Id",
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Descricao",
HeaderText = "Descricao da Despesa",
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Valor",
HeaderText = "Valor da Despesa",
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Categoria",
HeaderText = "Categoria da Despesa",
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Fornecedor",
HeaderText = "Fornecedor",
}
};
return colunas;
}
开发者ID:FilipeAndrade,项目名称:ePomar,代码行数:33,代码来源:DespesaControl.cs
示例14: DataGridViewSortCompareEventArgs
public DataGridViewSortCompareEventArgs (DataGridViewColumn dataGridViewColumn, object cellValue1, object cellValue2, int rowIndex1, int rowIndex2) {
this.dataGridViewColumn = dataGridViewColumn;
this.cellValue1 = cellValue1;
this.cellValue2 = cellValue2;
this.rowIndex1 = rowIndex1;
this.rowIndex2 = rowIndex2;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:DataGridViewSortCompareEventArgs.cs
示例15: GetColumnsSortedByDisplayIndex
public static IList<DataGridViewColumn> GetColumnsSortedByDisplayIndex(DataGridView dataGridView)
{
var result = new DataGridViewColumn[dataGridView.Columns.Count];
dataGridView.Columns.CopyTo(result, 0);
Array.Sort(result, (a, b) => a.DisplayIndex.CompareTo(b.DisplayIndex));
return result;
}
开发者ID:lgatto,项目名称:proteowizard,代码行数:7,代码来源:GridUtil.cs
示例16: ToArray
//-------------------------------------------------------------------------------------
/// <summary>
/// Возвращает коллекцию столбцов как массив.
/// </summary>
/// <returns></returns>
public static DataGridViewColumn[] ToArray(this DataGridViewColumnCollection cols)
{
DataGridViewColumn[] res = new DataGridViewColumn[cols.Count];
for(int a = 0; a < cols.Count; a++)
res[a] = cols[a];
return res;
}
开发者ID:GoldMax,项目名称:Pulsar.NET,代码行数:12,代码来源:DataGridViewExtensions.cs
示例17: CheckBoxColumnHeaderHandler
/// ------------------------------------------------------------------------------------
public CheckBoxColumnHeaderHandler(DataGridViewColumn col)
{
Debug.Assert(col != null);
Debug.Assert(col is DataGridViewCheckBoxColumn);
Debug.Assert(col.DataGridView != null);
_col = col;
_owningGrid = col.DataGridView;
_owningGrid.HandleDestroyed += HandleHandleDestroyed;
_owningGrid.CellPainting += HandleHeaderCellPainting;
_owningGrid.CellMouseMove += HandleHeaderCellMouseMove;
_owningGrid.CellMouseClick += HandleHeaderCellMouseClick;
_owningGrid.CellContentClick += HandleDataCellCellContentClick;
_owningGrid.Scroll += HandleGridScroll;
_owningGrid.RowsAdded += HandleGridRowsAdded;
_owningGrid.RowsRemoved += HandleGridRowsRemoved;
if (!BetterGrid.CanPaintVisualStyle())
_szCheckBox = new Size(13, 13);
else
{
var element = VisualStyleElement.Button.CheckBox.CheckedNormal;
var renderer = new VisualStyleRenderer(element);
using (var g = _owningGrid.CreateGraphics())
_szCheckBox = renderer.GetPartSize(g, ThemeSizeType.True);
}
}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:28,代码来源:CheckBoxColumnHeaderHandler.cs
示例18: AlleleCheckPrefab
// CONSTRUCTORS
public AlleleCheckPrefab(Allele allele, Series series, DataGridViewColumn column, int row)
{
_series = series;
_col = column;
build(allele, row);
}
开发者ID:Rabadash8820,项目名称:HardyWeinberg,代码行数:8,代码来源:AlleleCheckPrefab.cs
示例19: GetColunas
public override DataGridViewColumn[] GetColunas()
{
var colunas = new DataGridViewColumn[]
{
new DataGridViewTextBoxColumn
{
DataPropertyName = "Id",
HeaderText = "Id",
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Nome",
HeaderText = "Nome"
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Validade",
HeaderText = "Validade"
},
new DataGridViewTextBoxColumn
{
DataPropertyName = "Quantidade",
HeaderText = "Quantidade"
},
};
return colunas;
}
开发者ID:FilipeAndrade,项目名称:ePomar,代码行数:28,代码来源:ProdutoControl.cs
示例20: SetMatrix
/// <summary>
/// �\���Ώۂ̍s���ݒ肷��D
/// </summary>
/// <param name="m"></param>
public void SetMatrix(KrdLab.Lisys.Matrix m)
{
this.DataGridView.Rows.Clear();
this.DataGridView.Columns.Clear();
if (m == null)
{
return;
}
for (int c = 0; c < m.ColumnSize; ++c)
{
var gridCol = new DataGridViewColumn();
gridCol.HeaderText = String.Format("[ , {0}]", c);
gridCol.ReadOnly = true;
gridCol.SortMode = DataGridViewColumnSortMode.NotSortable;
this.DataGridView.Columns.Add(gridCol);
}
for (int r = 0; r < m.RowSize; ++r)
{
var gridRow = new DataGridViewRow();
gridRow.HeaderCell.Value = String.Format("[{0}, ]", r);
gridRow.ReadOnly = true;
var row = m.Rows[r];
foreach (var v in row)
{
var cell = new DataGridViewTextBoxCell();
cell.Value = v.ToString();
gridRow.Cells.Add(cell);
}
this.DataGridView.Rows.Add(gridRow);
}
this.DataGridView.RowHeadersWidth = 100;
}
开发者ID:krdlab,项目名称:lisys,代码行数:38,代码来源:MatrixVisualizerForm.cs
注:本文中的System.Windows.Forms.DataGridViewColumn类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论