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


C# Stack.AddChild方法代码示例

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


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

示例1: MessageBox

		public MessageBox() : base()
		{
			_frame = new MessageBoxFrame(Orientation.Vertical);
			Control = _frame;
			
			_bodyStack = new Stack(Orientation.Horizontal);
			_frame.AddChild(_bodyStack);
			_messageLabel = new Label();
			_bodyStack.AddChild(_messageLabel);
			
			_buttonStack = new GenericStack<Button>(Orientation.Horizontal);
			_frame.AddChild(_buttonStack);
			
			GrayScene = true;
			CloseOnOutsideClick = false;
		}
开发者ID:erisonliang,项目名称:monoworks,代码行数:16,代码来源:MessageBox.cs

示例2: ControlsScene

		public ControlsScene(Viewport viewport) : base(viewport)
		{
			Name = "Controls";
			
			// add an ActorInteractor to the viewport
			PrimaryInteractor = new ActorInteractor(this);
			
			
			// load the mwx file
			var mwx = new MwxSource(ResourceHelper.GetStream("demo.mwx"));
			
			
			// northeast buttons
			var cornerButtons = new CornerButtons(Corner.NE);
			//			cornerButtons.Image1 = Image.GetIcon("apply", 22);
			cornerButtons.Action1 += delegate(object sender, EventArgs e) {
				   Console.WriteLine("clicked apply");
			   };
			//			cornerButtons.Image2 = Image.GetIcon("cancel", 22);
			cornerButtons.Action2 += delegate(object sender, EventArgs e) {
				   Console.WriteLine("clicked cancel");
			   };
			var cornerAnchor = new AnchorPane(cornerButtons, AnchorLocation.NE);
			RenderList.AddOverlay(cornerAnchor);
			
			
			// northwest buttons
			cornerButtons = new CornerButtons(Corner.NW);
			//			cornerButtons.Image1 = Image.GetIcon("zoom-in", 22);
			cornerButtons.Action1 += delegate(object sender, EventArgs e) {
				  Console.WriteLine("clicked zoom-in");
			  };
			//			cornerButtons.Image2 = Image.GetIcon("zoom-out", 22);
			cornerButtons.Action2 += delegate(object sender, EventArgs e) {
				  Console.WriteLine("clicked zoom-out");
			  };
			cornerAnchor = new AnchorPane(cornerButtons, AnchorLocation.NW);
			RenderList.AddOverlay(cornerAnchor);
			
			
			// east control stack
			var stack = new Stack();
			stack.Orientation = Orientation.Vertical;
			
			var image = new Image(ResourceHelper.GetStream("plugin.png"));
			//			var image = Image.GetIcon("apply", 48);
			var button = new Button("Apply", image) { ButtonStyle = ButtonStyle.ImageOverLabel };
			button.Clicked += delegate(object sender, EventArgs e) {
				 Console.WriteLine("clicked apply");
			 };
			stack.AddChild(button);
			
			//			image = Image.GetIcon("cancel", 48);
			button = new Button("Cancel", image) { ButtonStyle = ButtonStyle.ImageOverLabel };
			button.Clicked += delegate(object sender, EventArgs e) {
				 Console.WriteLine("clicked cancel");
			 };
			stack.AddChild(button);
			
			var menuBox = new MenuBox();
			menuBox.Parse("One,Two,Three,Four");
			stack.AddChild(menuBox);
			
			var toolAnchor = new AnchorPane(stack, AnchorLocation.E);
			RenderList.AddOverlay(toolAnchor);
			
			
			// the controls dialog
			var controlsDialog = mwx.Get<Dialog>("controls-dialog");
			
			// attach the slider to its value label
			var slider = mwx.Get<Slider>("slider");
			var sliderValue = mwx.Get<Label>("sliderValue");
			sliderValue.Body = slider.Value.ToString("##.##");
			slider.ValueChanged += delegate(object sender, DoubleChangedEvent evt)
			{
				sliderValue.Body = evt.NewValue.ToString("##.##");
			};
			
			// attach the ForceStep checkbox to the slider
			var forceStepCheck = mwx.Get<CheckBox>("forceStepCheck");
			forceStepCheck.CheckChanged += delegate(object sender, BoolChangedEvent evt)
			{
				slider.ForceStep = evt.NewValue;
			};
			
			// floating toolbar
			var toolbar = new ToolBar();
			toolbar.Orientation = Orientation.Vertical;
			toolbar.ButtonStyle = ButtonStyle.ImageNextToLabel;
			
			//			image = Image.GetIcon("controls-dialog", 48);
			button = new Button("General Controls", image);
			button.Clicked += delegate(object sender, EventArgs e) { 
				ShowModal(controlsDialog);
			};
			toolbar.AddChild(button);
			
			
			// the progress dialog
//.........这里部分代码省略.........
开发者ID:erisonliang,项目名称:monoworks,代码行数:101,代码来源:ControlsScene.cs


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