本文整理汇总了C#中MatterHackers.Agg.UI.FlowLayoutWidget.AnchorAll方法的典型用法代码示例。如果您正苦于以下问题:C# FlowLayoutWidget.AnchorAll方法的具体用法?C# FlowLayoutWidget.AnchorAll怎么用?C# FlowLayoutWidget.AnchorAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.UI.FlowLayoutWidget
的用法示例。
在下文中一共展示了FlowLayoutWidget.AnchorAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintProgressBar
public PrintProgressBar()
{
MinimumSize = new Vector2(0, 24);
HAnchor = HAnchor.ParentLeftRight;
BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
Margin = new BorderDouble(0);
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight);
container.AnchorAll();
container.Padding = new BorderDouble(6,0);
printTimeElapsed = new TextWidget("", pointSize:11);
printTimeElapsed.AutoExpandBoundsToText = true;
printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;
printTimeRemaining = new TextWidget("", pointSize: 11);
printTimeRemaining.AutoExpandBoundsToText = true;
printTimeRemaining.VAnchor = Agg.UI.VAnchor.ParentCenter;
GuiWidget spacer = new GuiWidget();
spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
container.AddChild(printTimeElapsed);
container.AddChild(spacer);
container.AddChild(printTimeRemaining);
AddChild(container);
AddHandlers();
SetThemedColors();
UpdatePrintStatus();
UiThread.RunOnIdle(OnIdle);
}
示例2: PrintProgressBar
public PrintProgressBar(bool widgetIsExtended = true)
{
MinimumSize = new Vector2(0, 24);
HAnchor = HAnchor.ParentLeftRight;
BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
Margin = new BorderDouble(0);
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight);
container.AnchorAll();
container.Padding = new BorderDouble(6, 0);
printTimeElapsed = new TextWidget("", pointSize: 11);
printTimeElapsed.Printer.DrawFromHintedCache = true;
printTimeElapsed.AutoExpandBoundsToText = true;
printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;
printTimeRemaining = new TextWidget("", pointSize: 11);
printTimeRemaining.Printer.DrawFromHintedCache = true;
printTimeRemaining.AutoExpandBoundsToText = true;
printTimeRemaining.VAnchor = Agg.UI.VAnchor.ParentCenter;
GuiWidget spacer = new GuiWidget();
spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
container.AddChild(printTimeElapsed);
container.AddChild(spacer);
container.AddChild(printTimeRemaining);
AddChild(container);
if (ActiveTheme.Instance.IsTouchScreen)
{
upImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_up_32x24.png");
downImageBuffer = StaticData.Instance.LoadIcon("TouchScreen/arrow_down_32x24.png");
indicatorWidget = new ImageWidget(upImageBuffer);
indicatorWidget.HAnchor = HAnchor.ParentCenter;
indicatorWidget.VAnchor = VAnchor.ParentCenter;
WidgetIsExtended = widgetIsExtended;
GuiWidget indicatorOverlay = new GuiWidget();
indicatorOverlay.AnchorAll();
indicatorOverlay.AddChild(indicatorWidget);
AddChild(indicatorOverlay);
}
ClickWidget clickOverlay = new ClickWidget();
clickOverlay.AnchorAll();
clickOverlay.Click += onProgressBarClick;
AddChild(clickOverlay);
AddHandlers();
SetThemedColors();
UpdatePrintStatus();
UiThread.RunOnIdle(OnIdle);
}
示例3: MeshViewerApplication
public MeshViewerApplication(string meshFileToLoad = "")
: base(800, 600)
{
BackgroundColor = RGBA_Bytes.White;
MinimumSize = new VectorMath.Vector2(200, 200);
Title = "MatterHackers MeshViewr";
UseOpenGL = true;
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
viewArea = new GuiWidget();
viewArea.AnchorAll();
Vector3 viewerVolume = new Vector3(200, 200, 200);
double scale = 1;
meshViewerWidget = new MeshViewerWidget(viewerVolume, scale, MeshViewerWidget.BedShape.Rectangular, "No Part Loaded");
meshViewerWidget.AnchorAll();
viewArea.AddChild(meshViewerWidget);
mainContainer.AddChild(viewArea);
FlowLayoutWidget buttonPanel = new FlowLayoutWidget(FlowDirection.LeftToRight);
buttonPanel.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.Padding = new BorderDouble(3, 3);
buttonPanel.BackgroundColor = RGBA_Bytes.DarkGray;
if (meshFileToLoad != "")
{
meshViewerWidget.LoadMesh(meshFileToLoad);
}
else
{
openFileButton = new Button("Open 3D File", 0, 0);
openFileButton.Click += new Button.ButtonEventHandler(openFileButton_ButtonClick);
buttonPanel.AddChild(openFileButton);
}
bedCheckBox = new CheckBox("Bed");
bedCheckBox.Checked = true;
buttonPanel.AddChild(bedCheckBox);
wireframeCheckBox = new CheckBox("Wireframe");
buttonPanel.AddChild(wireframeCheckBox);
GuiWidget leftRightSpacer = new GuiWidget();
leftRightSpacer.HAnchor = HAnchor.ParentLeftRight;
buttonPanel.AddChild(leftRightSpacer);
mainContainer.AddChild(buttonPanel);
this.AddChild(mainContainer);
this.AnchorAll();
AddHandlers();
}
示例4: TemperatureWidgetBase
public TemperatureWidgetBase(string textValue)
: base(52 * TextWidget.GlobalPointSizeScaleRatio, 52 * TextWidget.GlobalPointSizeScaleRatio)
{
whiteButtonFactory.FixedHeight = 18 * TextWidget.GlobalPointSizeScaleRatio;
whiteButtonFactory.fontSize = 7;
whiteButtonFactory.normalFillColor = RGBA_Bytes.White;
whiteButtonFactory.normalTextColor = RGBA_Bytes.DarkGray;
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.AnchorAll();
this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200);
this.Margin = new BorderDouble(0, 2) * TextWidget.GlobalPointSizeScaleRatio;
GuiWidget labelContainer = new GuiWidget();
labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
labelContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;
labelTextWidget = new TextWidget("", pointSize: 8);
labelTextWidget.AutoExpandBoundsToText = true;
labelTextWidget.HAnchor = HAnchor.ParentCenter;
labelTextWidget.VAnchor = VAnchor.ParentCenter;
labelTextWidget.TextColor = ActiveTheme.Instance.SecondaryAccentColor;
labelTextWidget.Visible = false;
labelContainer.AddChild(labelTextWidget);
GuiWidget indicatorContainer = new GuiWidget();
indicatorContainer.AnchorAll();
indicatorTextWidget = new TextWidget(textValue, pointSize: 11);
indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor;
indicatorTextWidget.HAnchor = HAnchor.ParentCenter;
indicatorTextWidget.VAnchor = VAnchor.ParentCenter;
indicatorTextWidget.AutoExpandBoundsToText = true;
indicatorContainer.AddChild(indicatorTextWidget);
GuiWidget buttonContainer = new GuiWidget();
buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
buttonContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;
preheatButton = whiteButtonFactory.Generate("Preheat".Localize().ToUpper());
preheatButton.Cursor = Cursors.Hand;
preheatButton.Visible = false;
buttonContainer.AddChild(preheatButton);
container.AddChild(labelContainer);
container.AddChild(indicatorContainer);
container.AddChild(buttonContainer);
this.AddChild(container);
ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
this.MouseEnterBounds += onEnterBounds;
this.MouseLeaveBounds += onLeaveBounds;
this.preheatButton.Click += onPreheatButtonClick;
}
示例5: SetupConnectionWidgetBase
public SetupConnectionWidgetBase(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus printerSetupStatus = null)
: base(windowController, containerWindowToClose)
{
SetDisplayAttributes();
if (printerSetupStatus == null)
{
this.currentPrinterSetupStatus = new PrinterSetupStatus();
}
else
{
this.currentPrinterSetupStatus = printerSetupStatus;
}
cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
cancelButton.Name = "Setup Connection Cancel Button";
cancelButton.Click += new EventHandler(CancelButton_Click);
//Create the main container
GuiWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
mainContainer.Padding = new BorderDouble(3, 5, 3, 5);
mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
//Create the header row for the widget
headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
headerRow.Margin = new BorderDouble(0, 3, 0, 0);
headerRow.Padding = new BorderDouble(0, 3, 0, 3);
headerRow.HAnchor = HAnchor.ParentLeftRight;
{
string defaultHeaderTitle = LocalizedString.Get("3D Printer Setup");
headerLabel = new TextWidget(defaultHeaderTitle, pointSize: 14);
headerLabel.AutoExpandBoundsToText = true;
headerLabel.TextColor = this.defaultTextColor;
headerRow.AddChild(headerLabel);
}
//Create the main control container
contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom);
contentRow.Padding = new BorderDouble(5);
contentRow.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
contentRow.HAnchor = HAnchor.ParentLeftRight;
contentRow.VAnchor = VAnchor.ParentBottomTop;
//Create the footer (button) container
footerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
footerRow.HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight;
footerRow.Margin = new BorderDouble(0, 3);
mainContainer.AddChild(headerRow);
mainContainer.AddChild(contentRow);
mainContainer.AddChild(footerRow);
this.AddChild(mainContainer);
}
示例6: QueueControlsWidget
public QueueControlsWidget()
{
SetDisplayAttributes();
textImageButtonFactory.normalTextColor = RGBA_Bytes.White;
textImageButtonFactory.hoverTextColor = RGBA_Bytes.White;
textImageButtonFactory.disabledTextColor = RGBA_Bytes.White;
textImageButtonFactory.pressedTextColor = RGBA_Bytes.White;
textImageButtonFactory.borderWidth = 0;
FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);
{
{
// Ensure the form opens with no rows selected.
//ActiveQueueList.Instance.ClearSelected();
allControls.AddChild(PrintQueueControl.Instance);
}
FlowLayoutWidget buttonPanel1 = new FlowLayoutWidget();
buttonPanel1.HAnchor = HAnchor.ParentLeftRight;
buttonPanel1.Padding = new BorderDouble(0, 3);
{
Button addToQueueButton = textImageButtonFactory.Generate(new LocalizedString("Add").Translated, "icon_circle_plus.png");
buttonPanel1.AddChild(addToQueueButton);
addToQueueButton.Margin = new BorderDouble(0, 0, 3, 0);
addToQueueButton.Click += new ButtonBase.ButtonEventHandler(loadFile_Click);
Button deleteAllFromQueueButton = textImageButtonFactory.Generate(new LocalizedString("Remove All").Translated);
deleteAllFromQueueButton.Margin = new BorderDouble(3, 0);
deleteAllFromQueueButton.Click += new ButtonBase.ButtonEventHandler(deleteAllFromQueueButton_Click);
buttonPanel1.AddChild(deleteAllFromQueueButton);
GuiWidget spacer1 = new GuiWidget();
spacer1.HAnchor = HAnchor.ParentLeftRight;
buttonPanel1.AddChild(spacer1);
GuiWidget spacer2 = new GuiWidget();
spacer2.HAnchor = HAnchor.ParentLeftRight;
buttonPanel1.AddChild(spacer2);
GuiWidget queueMenu = new PrintQueueMenu();
queueMenu.VAnchor = VAnchor.ParentTop;
buttonPanel1.AddChild(queueMenu);
}
allControls.AddChild(buttonPanel1);
}
allControls.AnchorAll();
this.AddChild(allControls);
}
示例7: AddElements
private void AddElements()
{
FlowLayoutWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.Padding = new BorderDouble(3);
mainContainer.AnchorAll();
mainContainer.AddChild(GetTopRow());
mainContainer.AddChild(GetMiddleRow());
mainContainer.AddChild(GetBottomRow());
this.AddChild(mainContainer);
}
示例8: ListBoxPage
public ListBoxPage()
: base("List Box Widget")
{
FlowLayoutWidget leftToRightLayout = new FlowLayoutWidget();
leftToRightLayout.AnchorAll();
{
{
leftListBox = new ListBox(new RectangleDouble(0, 0, 200, 300));
//leftListBox.BackgroundColor = RGBA_Bytes.Red;
leftListBox.Name = "LeftListBox";
leftListBox.VAnchor = UI.VAnchor.ParentTop;
//leftListBox.DebugShowBounds = true;
leftListBox.Margin = new BorderDouble(15);
leftToRightLayout.AddChild(leftListBox);
for (int i = 0; i < 1; i++)
{
leftListBox.AddChild(new ListBoxTextItem("hand" + i.ToString() + ".stl", "c:\\development\\hand" + i.ToString() + ".stl"));
}
}
if (true)
{
ListBox rightListBox = new ListBox(new RectangleDouble(0, 0, 200, 300));
rightListBox.VAnchor = UI.VAnchor.ParentTop;
rightListBox.Margin = new BorderDouble(15);
leftToRightLayout.AddChild(rightListBox);
for (int i = 0; i < 30; i++)
{
switch (i % 3)
{
case 0:
rightListBox.AddChild(new ListBoxTextItem("ListBoxTextItem" + i.ToString() + ".stl", "c:\\development\\hand" + i.ToString() + ".stl"));
break;
case 1:
rightListBox.AddChild(new Button("Button" + i.ToString() + ".stl"));
break;
case 2:
rightListBox.AddChild(new RadioButton("RadioButton" + i.ToString() + ".stl"));
break;
}
}
}
}
AddChild(leftToRightLayout);
}
示例9: ButtonsPage
public ButtonsPage()
: base("Radio and Check Buttons")
{
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottom.AddChild(new CheckBox("Simple Check Box"));
CheckBoxViewStates fourStates = new CheckBoxViewStates(new TextWidget("normal"), new TextWidget("normal"),
new TextWidget("switch n->p"),
new TextWidget("pressed"), new TextWidget("pressed"),
new TextWidget("switch p->n"),
new TextWidget("disabled"));
topToBottom.AddChild(new CheckBox(fourStates));
GuiWidget normalPressed = new TextWidget("0 4state");
normalPressed.BackgroundColor = RGBA_Bytes.Gray;
GuiWidget downPressed = new TextWidget("1 4state");
downPressed.BackgroundColor = RGBA_Bytes.Gray;
GuiWidget normalHover = new TextWidget("0 4state");
normalHover.BackgroundColor = RGBA_Bytes.Yellow;
GuiWidget downHover = new TextWidget("1 4state");
downHover.BackgroundColor = RGBA_Bytes.Yellow;
CheckBoxViewStates fourStates2 = new CheckBoxViewStates(new TextWidget("0 4state"), normalHover, normalPressed, new TextWidget("1 4state"), downHover, downPressed, new TextWidget("disabled"));
topToBottom.AddChild(new CheckBox(fourStates2));
topToBottom.AddChild(new RadioButton("Simple Radio Button 1"));
topToBottom.AddChild(new RadioButton("Simple Radio Button 2"));
topToBottom.AddChild(new RadioButton(new RadioButtonViewText("Simple Radio Button 3")));
topToBottom.AddChild(new RadioButton(new RadioButtonViewStates(new TextWidget("O - unchecked"), new TextWidget("O - unchecked hover"), new TextWidget("O - checking"), new TextWidget("X - checked"), new TextWidget("disabled"))));
groupBox = new GroupBox("Radio Group");
//groupBox.LocalBounds = new RectangleDouble(0, 0, 300, 150);
groupBox.OriginRelativeParent = new Vector2(200, 350);
FlowLayoutWidget topToBottomRadios = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottomRadios.AnchorAll();
topToBottomRadios.AddChild(new RadioButton("Simple Radio Button 1"));
topToBottomRadios.AddChild(new RadioButton("Simple Radio Button 2"));
topToBottomRadios.AddChild(new RadioButton("Simple Radio Button 3"));
topToBottomRadios.SetBoundsToEncloseChildren();
groupBox.AddChild(topToBottomRadios);
topToBottom.AddChild(groupBox);
AddChild(topToBottom);
topToBottom.VAnchor = UI.VAnchor.ParentTop;
}
示例10: SetupConnectionWidgetBase
public SetupConnectionWidgetBase(ConnectionWizard wizard) : base(wizard)
{
SetDisplayAttributes();
cancelButton = textImageButtonFactory.Generate("Cancel".Localize());
cancelButton.Name = "Setup Connection Cancel Button";
cancelButton.Click += CancelButton_Click;
//Create the main container
GuiWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainContainer.AnchorAll();
mainContainer.Padding = new BorderDouble(3, 5, 3, 5);
mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
//Create the header row for the widget
headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
headerRow.Margin = new BorderDouble(0, 3, 0, 0);
headerRow.Padding = new BorderDouble(0, 3, 0, 3);
headerRow.HAnchor = HAnchor.ParentLeftRight;
{
headerLabel = new TextWidget("3D Printer Setup".Localize(), pointSize: 14);
headerLabel.AutoExpandBoundsToText = true;
headerLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
headerRow.AddChild(headerLabel);
}
//Create the main control container
contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom);
contentRow.Padding = new BorderDouble(5);
contentRow.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
contentRow.HAnchor = HAnchor.ParentLeftRight;
contentRow.VAnchor = VAnchor.ParentBottomTop;
//Create the footer (button) container
footerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
footerRow.HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight;
footerRow.Margin = new BorderDouble(0, 3);
mainContainer.AddChild(headerRow);
mainContainer.AddChild(contentRow);
mainContainer.AddChild(footerRow);
this.AddChild(mainContainer);
}
示例11: TopToBottomContainerAppliesExpectedMarginToToggleView
public void TopToBottomContainerAppliesExpectedMarginToToggleView()
{
TestContext.CurrentContext.SetCompatibleWorkingDirectory();
int marginSize = 40;
int dimensions = 300;
GuiWidget outerContainer = new GuiWidget(dimensions, dimensions);
FlowLayoutWidget topToBottomContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.ParentLeftRight,
VAnchor = VAnchor.ParentBottomTop,
};
outerContainer.AddChild(topToBottomContainer);
CheckBox toggleBox = new CheckBox("test");
toggleBox.HAnchor = HAnchor.ParentLeftRight;
toggleBox.VAnchor = VAnchor.ParentBottomTop;
toggleBox.Margin = new BorderDouble(marginSize);
toggleBox.BackgroundColor = RGBA_Bytes.Red;
toggleBox.DebugShowBounds = true;
topToBottomContainer.AddChild(toggleBox);
topToBottomContainer.AnchorAll();
topToBottomContainer.PerformLayout();
outerContainer.DoubleBuffer = true;
outerContainer.BackBuffer.NewGraphics2D().Clear(RGBA_Bytes.White);
outerContainer.OnDraw(outerContainer.NewGraphics2D());
// For troubleshooting or visual validation
OutputImages(outerContainer, outerContainer);
var bounds = toggleBox.BoundsRelativeToParent;
Assert.IsTrue(bounds.Left == marginSize, "Left margin is incorrect");
Assert.IsTrue(bounds.Right == dimensions - marginSize, "Right margin is incorrect");
Assert.IsTrue(bounds.Top == dimensions - marginSize, "Top margin is incorrect");
Assert.IsTrue(bounds.Bottom == marginSize, "Bottom margin is incorrect");
}
示例12: FontHinter
public FontHinter()
{
AnchorAll();
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottom.AnchorAll();
pixelSizeSlider = new Slider(new Vector2(30, 30), 600 - 60);
gammaSlider = new Slider(new Vector2(30, 70), 600 - 60);
pixelSizeSlider.Text = "Pixel size={0:F3}";
pixelSizeSlider.SetRange(2, 20);
pixelSizeSlider.NumTicks = 23;
pixelSizeSlider.Value = 6;
gammaSlider.Text = "Gamma={0:F3}";
gammaSlider.SetRange(0.0, 3.0);
gammaSlider.Value = 1.0;
topToBottom.AddChild(pixelSizeSlider);
topToBottom.AddChild(gammaSlider);
AddChild(topToBottom);
}
示例13: AddElements
void AddElements()
{
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.AnchorAll();
ApplicationMenuRow menuRow = new ApplicationMenuRow();
container.AddChild(menuRow);
GuiWidget menuSeparator = new GuiWidget();
menuSeparator.BackgroundColor = new RGBA_Bytes(200, 200, 200);
menuSeparator.Height = 2;
menuSeparator.HAnchor = HAnchor.ParentLeftRight;
menuSeparator.Margin = new BorderDouble(3, 6,3,3);
container.AddChild(menuSeparator);
widescreenPanel = new WidescreenPanel();
container.AddChild(widescreenPanel);
this.AddChild(container);
}
示例14: WizardControl
public WizardControl()
{
Padding = new BorderDouble(10);
textImageButtonFactory.normalTextColor = RGBA_Bytes.White;
textImageButtonFactory.hoverTextColor = RGBA_Bytes.White;
textImageButtonFactory.disabledTextColor = new RGBA_Bytes(200, 200, 200);
textImageButtonFactory.disabledFillColor = new RGBA_Bytes(0, 0, 0, 0);
textImageButtonFactory.pressedTextColor = RGBA_Bytes.White;
AnchorAll();
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
bottomToTopLayout = new FlowLayoutWidget(FlowDirection.BottomToTop);
FlowLayoutWidget buttonBar = new FlowLayoutWidget();
textImageButtonFactory.FixedWidth = 60;
backButton = textImageButtonFactory.Generate(new LocalizedString("Back").Translated, centerText: true);
backButton.Click += new ButtonBase.ButtonEventHandler(back_Click);
nextButton = textImageButtonFactory.Generate(new LocalizedString("Next").Translated, centerText: true);
nextButton.Click += new ButtonBase.ButtonEventHandler(next_Click);
doneButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated, centerText: true);
doneButton.Click += new ButtonBase.ButtonEventHandler(done_Click);
textImageButtonFactory.FixedWidth = 0;
buttonBar.AddChild(backButton);
buttonBar.AddChild(nextButton);
buttonBar.AddChild(doneButton);
bottomToTopLayout.AddChild(buttonBar);
bottomToTopLayout.AnchorAll();
AddChild(bottomToTopLayout);
}
示例15: StyledMessageBox
public StyledMessageBox(Action<bool> callback, String message, string windowTitle, MessageType messageType, GuiWidget[] extraWidgetsToAdd, double width, double height, string yesOk, string no)
: base(width, height)
{
if (UserSettings.Instance.IsTouchScreen)
{
extraTextScaling = 1.33333;
}
textImageButtonFactory.fontSize = extraTextScaling * textImageButtonFactory.fontSize;
if (yesOk == "")
{
if (messageType == MessageType.OK)
{
yesOk = "Ok".Localize();
}
else
{
yesOk = "Yes".Localize();
}
}
if (no == "")
{
no = "No".Localize();
}
responseCallback = callback;
unwrappedMessage = message;
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottom.AnchorAll();
if (UserSettings.Instance.IsTouchScreen)
{
topToBottom.Padding = new BorderDouble(12, 12, 13, 8);
}
else
{
topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
}
// Creates Header
FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
headerRow.HAnchor = HAnchor.ParentLeftRight;
headerRow.Margin = new BorderDouble(0, 3, 0, 0);
headerRow.Padding = new BorderDouble(0, 3, 0, 3);
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
//Creates Text and adds into header
{
TextWidget elementHeader = new TextWidget(windowTitle, pointSize: 14 * extraTextScaling);
elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
elementHeader.HAnchor = HAnchor.ParentLeftRight;
elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;
headerRow.AddChild(elementHeader);
topToBottom.AddChild(headerRow);
}
// Creates container in the middle of window
middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
{
middleRowContainer.HAnchor = HAnchor.ParentLeftRight;
middleRowContainer.VAnchor = VAnchor.ParentBottomTop;
// normally the padding for the middle container should be just (5) all around. The has extra top space
middleRowContainer.Padding = new BorderDouble(5, 5, 5, 15);
middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
}
messageContainer = new TextWidget(message, textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 12 * extraTextScaling);
messageContainer.AutoExpandBoundsToText = true;
messageContainer.HAnchor = Agg.UI.HAnchor.ParentLeft;
middleRowContainer.AddChild(messageContainer);
if (extraWidgetsToAdd != null)
{
foreach (GuiWidget widget in extraWidgetsToAdd)
{
middleRowContainer.AddChild(widget);
}
}
topToBottom.AddChild(middleRowContainer);
//Creates button container on the bottom of window
FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
{
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
buttonRow.HAnchor = HAnchor.ParentLeftRight;
buttonRow.Padding = new BorderDouble(0, 3);
}
switch (messageType)
{
case MessageType.YES_NO:
{
Title = "MatterControl - " + "Please Confirm".Localize();
Button yesButton = textImageButtonFactory.Generate(yesOk, centerText: true);
yesButton.Name = "Yes Button";
yesButton.Click += new EventHandler(okButton_Click);
yesButton.Cursor = Cursors.Hand;
buttonRow.AddChild(yesButton);
//.........这里部分代码省略.........