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


C# Panel.parent方法代码示例

本文整理汇总了C#中System.Windows.Forms.Panel.parent方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.parent方法的具体用法?C# Panel.parent怎么用?C# Panel.parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Panel的用法示例。


在下文中一共展示了Panel.parent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buildGui

		public Win32_Handle_Hijack buildGui()
		{									
			Action restore = 
				()=>{												
						if (hijackedHandle != IntPtr.Zero)
						{
							"restoring {0} to parent {1}".info(hijackedHandle, hijackedParent);
							hijackedHandle.setParent(hijackedParent);
							hijackedParent.window_Redraw();
							hijackedHandle.window_Redraw();
						}
					};
					
			Action hijack = 
				()=>{ 
						restore();
						var handle = targetHandle.get_Text().toInt().intPtr();						
						var newParent = hijackedWindow.clear().handle();
						"Hijacking {0} into window {1}".info(handle, newParent);
						hijackedHandle = handle;
						hijackedParent = parentHandle.get_Text().toInt().intPtr();
						handle.setParent(newParent);						
					};					
			Action screenShot = 
				()=>{	
						restore();
						try
						{
							var handle = targetHandle.get_Text().toInt().intPtr();						
							var bitmap = handle.window_ScreenShot();
							hijackedWindow.clear().add_PictureBox().layout_Zoom().show(bitmap);
						}
						catch(Exception ex)
						{
							ex.log();
						}
					};
			Action<IntPtr> setTarget = 
				(handle)=>{
							 	targetHandle.set_Text(handle.str());
							 	className.set_Text(handle.className());
							 	pictureBox.show(handle.window_ScreenShot());
								//pictureBox
							};
			topPanel = this.add_Panel();				
			topPanel.insert_Above(35).splitContainerFixed()
						.add_WindowFinder(ref windowFinder) 
						.append_Label("Handle:").top(10).append_TextBox(ref targetHandle)
						.append_Label("Parent:").top(10).append_TextBox(ref parentHandle)
						.append_Link("Hijack", ()=> hijack()).top(10)
						.append_Link("Restore", ()=> restore()) 
						.append_Link("Screenshot", ()=> screenShot()) 
						.append_PictureBox(ref pictureBox)
						.append_TextBox(ref test).set_Text("Hijack me").top(10) 
						.append_Label(ref className).topAdd(2);

				
						
			hijackedWindow = topPanel.add_GroupBox("Hijacked Window/Control").add_Panel();		
					
			targetHandle.onTextChange((text)=> parentHandle.set_Text(text.toInt().intPtr().parent().str())); 
			windowFinder.Window_Changed = setTarget; 
				
//			setTarget(test.handle()); 
			
			pictureBox.layout_Zoom();					  
			this.onClosed(
				()=>{
						"On Closed".info();
						restore();
					});
			var groupBox = hijackedWindow.parent();;
			var originalText = groupBox.get_Text();
			var splitcontainer = groupBox.splitContainer();
			
			groupBox.DoubleClick+=(sender,e)=>
				{		
					var collapsed = splitcontainer.Panel1Collapsed;
					if (collapsed)
					{
						splitcontainer.panel1Collapsed(false);					
						groupBox.set_Text(originalText);		
					}
					else
					{
						splitcontainer.panel1Collapsed(true);		
						groupBox.set_Text(".");			
					}
				};	
			return this;	
		}
开发者ID:paul-green,项目名称:O2.Platform.Scripts,代码行数:91,代码来源:API_Win32_Handle_Hijack.cs


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