本文整理汇总了C#中System.Windows.Forms.DataGridView.add_ContextMenu方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.add_ContextMenu方法的具体用法?C# DataGridView.add_ContextMenu怎么用?C# DataGridView.add_ContextMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridView
的用法示例。
在下文中一共展示了DataGridView.add_ContextMenu方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ascx_Start_Tools
public ascx_Start_Tools()
{
dataGridView = this.add_DataGridView();
dataGridView.AllowUserToAddRows = true;
dataGridView.AllowUserToDeleteRows = true;
dataGridView.add_Columns(typeof(ProcessDetail));
dataGridView.add_Column_Link("Start", true);
dataGridView.onClick(startProcess);
dataGridView.onDrop(loadFile);
var menu = dataGridView.add_ContextMenu();
menu.add_MenuItem("save", (menuItem) => saveCurrentList());
loadList();
}
示例3: 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());*/
}
});
}
示例4: showGui
public string showGui(string userDataDirectory)
{
var panel = O2Gui.open<Panel>("Secret Data Files", 750, 200);
var controls = panel.add_1x1("Folder with secret data files", "SecretData", true, 230);
directory = controls[0].add_Directory(userDataDirectory);
if (userDataDirectory.files().size() == 0)
new SecretData().serialize(userDataDirectory.pathCombine("SecretData.xml"));
directory.parent().insert_Below<Panel>(30)
.add_Link("Create new Secret's file", 5, 0, createNewSecretsFile)
.append_Link("Save Loaded File", saveLoadedSecretsFile);
dataGridView = controls[1].add_DataGridView();
dataGridView.AllowUserToAddRows = true;
dataGridView.AllowUserToDeleteRows = true;
dataGridView.add_Columns(typeof(Credential));
var contextMenu = dataGridView.add_ContextMenu();
contextMenu.add_MenuItem("Save", saveLoadedSecretsFile);
contextMenu.add_MenuItem("Create new File", createNewSecretsFile);
directory.afterFileSelect(loadFile);
statusLabel = panel.parentForm().add_StatusStrip();
statusMessage("Select Secrets file to load from TreeView on the left");
return "done";
}