本文整理汇总了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;
}
示例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
//.........这里部分代码省略.........