本文整理汇总了C#中System.Windows.Forms.DataGridView.add_Column方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.add_Column方法的具体用法?C# DataGridView.add_Column怎么用?C# DataGridView.add_Column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.add_Column方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadServicesData
public void loadServicesData()
{
"Loading Services Data".info();
this.invokeOnThread(
()=> {
this.clear();
dataGridView = this.add_DataGridView();
dataGridView.CellContentClick+= (sender,e) => cellClicked(e.RowIndex,e.ColumnIndex);
dataGridView.Columns.Clear();
var menu = dataGridView.add_ContextMenu();
menu.add_MenuItem("refresh", (menuItem) => loadServicesData());
var services = ServiceController.GetServices();
dataGridView.add_Column("Display Name");
dataGridView.add_Column("Service Name");
dataGridView.add_Column("Service Type");
dataGridView.add_Column_Link("stop service");
foreach(var service in services)
{
if (service.CanStop)
{
var id = dataGridView.add_Row(
service.DisplayName,
service.ServiceName,
service.ServiceType,
"stop");
dataGridView.Rows[id].Tag = service;
}
}
});
}
示例2: loadProcessData
public void loadProcessData()
{
"Loading Processes Data".info();
this.invokeOnThread(
()=> {
this.clear();
dataGridView = this.add_DataGridView();
dataGridView.CellContentClick+= (sender,e) => cellClicked(e.RowIndex,e.ColumnIndex);
dataGridView.Columns.Clear();
var menu = dataGridView.add_ContextMenu();
menu.add_MenuItem("refresh", (menuItem) => loadProcessData());
//menu.add("close", (menuItem) => ParentForm.Close());
//dataGridView.SelectionChanged+=(sender,e)=> dataGridView.ClearSelection();
// use this to see all available properties
//foreach(var property in Processes.getCurrentProcess().type().properties())
// dataGridView.column(property.Name,150);
dataGridView.add_Column("Name");
dataGridView.add_Column("Window Title");
dataGridView.add_Column("Id");
dataGridView.add_Column("Handle");
dataGridView.add_Column("Paged Memory Size (Mb)");
dataGridView.add_Column("Working Set (Mb)");
dataGridView.add_Column("Priority Class");
dataGridView.add_Column_Link("stop process");
var megaByte = 1024*1024;
foreach(var process in Processes.getProcesses())
{
var id = dataGridView.add_Row( process.ProcessName,
process.MainWindowTitle,
process.Id,
process.prop("Handle"),
(double)process.PagedMemorySize64 / megaByte,
(double)process.WorkingSet64 / megaByte,
process.prop("PriorityClass"),
"stop");
dataGridView.Rows[id].Tag = process;
// use this to see all available properties
/*var rowCells = new List<object>();
foreach(var property in process.type().properties())
rowCells.Add(process.prop(property.Name));
dataGridView.row(rowCells.ToArray());*/
}
});
}