当前位置: 首页>>代码示例>>C#>>正文


C# DataGridView.add_ContextMenu方法代码示例

本文整理汇总了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;
			        	 	}	    	 		
			        	 }        	 
			        });
		}
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:34,代码来源:ascx_Services_Stop.cs

示例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();    		
  	}   
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:14,代码来源:ascx_Start_Tools.cs

示例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());*/        	 		
			        	 }        	 
			        });
		}
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:47,代码来源:ascx_Processes_Stop.cs

示例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";
        }
开发者ID:njmube,项目名称:FluentSharp,代码行数:27,代码来源:SecretDataEditor.cs


注:本文中的System.Windows.Forms.DataGridView.add_ContextMenu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。