本文整理汇总了C#中MatterHackers.Agg.UI.FlowLayoutWidget.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# FlowLayoutWidget.AddChild方法的具体用法?C# FlowLayoutWidget.AddChild怎么用?C# FlowLayoutWidget.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.UI.FlowLayoutWidget
的用法示例。
在下文中一共展示了FlowLayoutWidget.AddChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RayTracerWindow
public RayTracerWindow(int width, int height)
: base(width, height)
{
//CalculateIntersectCostsAndSaveToFile();
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.HAnchor |= HAnchor.ParentLeftRight;
leftToRight.VAnchor |= VAnchor.ParentBottomTop;
previewWindowRayTrace = new RayTraceWidget();
AnchorAll();
previewWindowRayTrace.AnchorAll();
leftToRight.AddChild(previewWindowRayTrace);
GuiWidget zBuffer = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.ParentBottomTop);
zBuffer.BackgroundColor = RGBA_Bytes.Blue;
leftToRight.AddChild(zBuffer);
AddChild(leftToRight);
BackgroundColor = RGBA_Bytes.Black;
ShowAsSystemWindow();
}
示例2: createPrinterConnectionMessageContainer
public FlowLayoutWidget createPrinterConnectionMessageContainer()
{
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.Margin = new BorderDouble(5);
BorderDouble elementMargin = new BorderDouble(top: 5);
TextWidget continueMessage = new TextWidget("Would you like to connect to this printer now?", 0, 0, 12);
continueMessage.AutoExpandBoundsToText = true;
continueMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
continueMessage.HAnchor = HAnchor.ParentLeftRight;
continueMessage.Margin = elementMargin;
TextWidget continueMessageTwo = new TextWidget("You can always configure this later.", 0, 0, 10);
continueMessageTwo.AutoExpandBoundsToText = true;
continueMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
continueMessageTwo.HAnchor = HAnchor.ParentLeftRight;
continueMessageTwo.Margin = elementMargin;
printerErrorMessage = new TextWidget("", 0, 0, 10);
printerErrorMessage.AutoExpandBoundsToText = true;
printerErrorMessage.TextColor = RGBA_Bytes.Red;
printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
printerErrorMessage.Margin = elementMargin;
container.AddChild(continueMessage);
container.AddChild(continueMessageTwo);
container.AddChild(printerErrorMessage);
container.HAnchor = HAnchor.ParentLeftRight;
return container;
}
示例3: ThemeColorSelectorWidget
public ThemeColorSelectorWidget(GuiWidget colorToChangeTo)
{
this.Padding = new BorderDouble(2, 0);
this.colorToChangeTo = colorToChangeTo;
int themeCount = ActiveTheme.AvailableThemes.Count;
var allThemes = ActiveTheme.AvailableThemes;
int index = 0;
for (int x = 0; x < themeCount / 2; x++)
{
var columnContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom)
{
Width = containerHeight
};
columnContainer.AddChild(CreateThemeButton(allThemes[index]));
int secondRowIndex = index + themeCount / 2;
columnContainer.AddChild(CreateThemeButton(allThemes[secondRowIndex]));
this.AddChild(columnContainer);
index++;
}
this.BackgroundColor = RGBA_Bytes.White;
this.Width = containerHeight * (themeCount / 2);
}
示例4: CameraCalibrationWidget
public CameraCalibrationWidget()
{
SuspendLayout();
FlowLayoutWidget TopToBottomLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
{
FlowLayoutWidget TopButtons = new FlowLayoutWidget(FlowDirection.LeftToRight);
{
connectButton = new Button("Connect");
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
TopButtons.AddChild(connectButton);
}
TopToBottomLayout.AddChild(TopButtons);
xyJogControls = new XYJogControls();
TopToBottomLayout.AddChild(xyJogControls);
disableMotors = new Button("Disable Motors");
disableMotors.Click += new ButtonBase.ButtonEventHandler(disableMotors_Click);
TopToBottomLayout.AddChild(disableMotors);
}
AddChild(TopToBottomLayout);
ResumeLayout();
}
示例5: PrinterConfigurationWidget
public PrinterConfigurationWidget()
{
SetDisplayAttributes();
HAnchor = Agg.UI.HAnchor.ParentLeftRight;
VAnchor = Agg.UI.VAnchor.FitToChildren;
FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainLayoutContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
mainLayoutContainer.Padding = new BorderDouble(top: 10);
if (!ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_hardware_leveling))
{
mainLayoutContainer.AddChild(new CalibrationSettingsWidget());
}
mainLayoutContainer.AddChild(new HardwareSettingsWidget());
CloudSettingsWidget cloudGroupbox = new CloudSettingsWidget();
mainLayoutContainer.AddChild(cloudGroupbox);
ApplicationSettingsWidget applicationGroupbox = new ApplicationSettingsWidget();
mainLayoutContainer.AddChild(applicationGroupbox);
AddChild(mainLayoutContainer);
AddHandlers();
//SetVisibleControls();
}
示例6: PrinterConfigurationWidget
public PrinterConfigurationWidget()
{
SetDisplayAttributes();
HAnchor = Agg.UI.HAnchor.ParentLeftRight;
VAnchor = Agg.UI.VAnchor.FitToChildren;
FlowLayoutWidget mainLayoutContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
mainLayoutContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
mainLayoutContainer.VAnchor = Agg.UI.VAnchor.FitToChildren;
mainLayoutContainer.Padding = new BorderDouble(top: 10);
HardwareSettingsWidget hardwareGroupbox = new HardwareSettingsWidget();
mainLayoutContainer.AddChild(hardwareGroupbox);
CloudSettingsWidget cloudGroupbox = new CloudSettingsWidget();
mainLayoutContainer.AddChild(cloudGroupbox);
ApplicationSettingsWidget applicationGroupbox = new ApplicationSettingsWidget();
mainLayoutContainer.AddChild(applicationGroupbox);
AddChild(mainLayoutContainer);
AddHandlers();
//SetVisibleControls();
}
示例7: AddChildElements
protected override void AddChildElements()
{
AltGroupBox fanControlsGroupBox = new AltGroupBox(new TextWidget("Fan".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
fanControlsGroupBox.Margin = new BorderDouble(0);
fanControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor;
fanControlsGroupBox.HAnchor |= Agg.UI.HAnchor.ParentLeftRight;
fanControlsGroupBox.VAnchor = Agg.UI.VAnchor.FitToChildren;
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
this.AddChild(fanControlsGroupBox);
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
FlowLayoutWidget fanControlsLayout = new FlowLayoutWidget(FlowDirection.TopToBottom);
fanControlsLayout.Padding = new BorderDouble(3, 5, 3, 0);
{
fanControlsLayout.AddChild(CreateFanControls());
}
leftToRight.AddChild(fanControlsLayout);
SetDisplayAttributes();
fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString()), "100%");
fanSpeedDisplay.EditComplete += (sender, e) =>
{
PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
};
leftToRight.AddChild(fanSpeedDisplay);
fanControlsGroupBox.AddChild(leftToRight);
}
示例8: 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);
}
示例9: RunningMacroPage
public RunningMacroPage(string message, bool showOkButton, bool showMaterialSelector, double expectedSeconds, double expectedTemperature)
: base("Close", "Macro Feedback")
{
TextWidget syncingText = new TextWidget(message, textColor: ActiveTheme.Instance.PrimaryTextColor);
contentRow.AddChild(syncingText);
footerRow.AddChild(new HorizontalSpacer());
footerRow.AddChild(cancelButton);
if (showMaterialSelector)
{
int extruderIndex = 0;
contentRow.AddChild(new PresetSelectorWidget(string.Format($"{"Material".Localize()} {extruderIndex + 1}"), RGBA_Bytes.Orange, NamedSettingsLayers.Material, extruderIndex));
}
var holder = new FlowLayoutWidget();
progressBar = new ProgressBar((int)(150 * GuiWidget.DeviceScale), (int)(15 * GuiWidget.DeviceScale))
{
FillColor = ActiveTheme.Instance.PrimaryAccentColor,
BorderColor = ActiveTheme.Instance.PrimaryTextColor,
//HAnchor = HAnchor.ParentCenter,
Margin = new BorderDouble(3, 0, 0, 10),
};
progressBarText = new TextWidget("", pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor)
{
AutoExpandBoundsToText = true,
Margin = new BorderDouble(5, 0, 0, 0),
};
holder.AddChild(progressBar);
holder.AddChild(progressBarText);
contentRow.AddChild(holder);
progressBar.Visible = false;
if (expectedSeconds > 0)
{
timeToWaitMs = (long)(expectedSeconds * 1000);
endTimeMs = UiThread.CurrentTimerMs + timeToWaitMs;
UiThread.RunOnIdle(CountDownTime, 1);
progressBar.Visible = true;
}
PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent(LookForTempRequest, ref unregisterEvents);
if (showOkButton)
{
Button okButton = textImageButtonFactory.Generate("Continue".Localize());
okButton.Margin = new BorderDouble(0, 0, 0, 25);
okButton.HAnchor = HAnchor.ParentCenter;
okButton.Click += (s, e) =>
{
PrinterConnectionAndCommunication.Instance.MacroContinue();
UiThread.RunOnIdle(() => WizardWindow?.Close());
};
contentRow.AddChild(okButton);
}
}
示例10: TextImageWidget
public TextImageWidget(string label, RGBA_Bytes fillColor, RGBA_Bytes borderColor, RGBA_Bytes textColor, double borderWidth, BorderDouble margin, ImageBuffer image = null, double fontSize = 12, FlowDirection flowDirection = FlowDirection.LeftToRight, double height = 40, double width = 0, bool centerText = false, double imageSpacing = 0)
: base()
{
this.image = image;
this.fillColor = fillColor;
this.borderColor = borderColor;
this.borderWidth = borderWidth;
this.Margin = new BorderDouble(0);
this.Padding = new BorderDouble(0);
TextWidget textWidget = new TextWidget(label, pointSize: fontSize);
ImageWidget imageWidget;
FlowLayoutWidget container = new FlowLayoutWidget(flowDirection);
if (centerText)
{
// make sure the contents are centered
GuiWidget leftSpace = new GuiWidget(0, 1);
leftSpace.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
container.AddChild(leftSpace);
}
if (image != null && image.Width > 0)
{
imageWidget = new ImageWidget(image);
imageWidget.VAnchor = VAnchor.ParentCenter;
imageWidget.Margin = new BorderDouble(right: imageSpacing);
container.AddChild(imageWidget);
}
if (label != "")
{
textWidget.VAnchor = VAnchor.ParentCenter;
textWidget.TextColor = textColor;
textWidget.Padding = new BorderDouble(3, 0);
container.AddChild(textWidget);
}
if (centerText)
{
GuiWidget rightSpace = new GuiWidget(0, 1);
rightSpace.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
container.AddChild(rightSpace);
container.HAnchor = Agg.UI.HAnchor.ParentLeftRight | Agg.UI.HAnchor.FitToChildren;
}
container.VAnchor = Agg.UI.VAnchor.ParentCenter;
container.MinimumSize = new Vector2(width, height);
container.Margin = margin;
this.AddChild(container);
HAnchor = HAnchor.ParentLeftRight | HAnchor.FitToChildren;
VAnchor = VAnchor.ParentCenter | Agg.UI.VAnchor.FitToChildren;
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: MessageBox
public MessageBox(String message, string windowTitle, MessageType messageType, double width, double height)
: base(width, height)
{
BackgroundColor = new RGBA_Bytes(50, 50, 50, 240);
FlowLayoutWidget topToBottomFlow = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottomFlow.HAnchor = Agg.UI.HAnchor.ParentCenter;
topToBottomFlow.VAnchor = Agg.UI.VAnchor.ParentCenter;
topToBottomFlow.AddChild(new TextWidget(message, textColor: RGBA_Bytes.White));
Title = windowTitle;
// add a spacer
topToBottomFlow.AddChild(new GuiWidget(10, 10));
switch (messageType)
{
case MessageType.YES_NO:
{
FlowLayoutWidget yesNoButtonsFlow = new FlowLayoutWidget();
Button yesButton = new Button("Yes");
yesButton.Click += new ButtonBase.ButtonEventHandler(okButton_Click);
yesNoButtonsFlow.AddChild(yesButton);
Button noButton = new Button("No");
noButton.Click += new ButtonBase.ButtonEventHandler(noButton_Click);
yesNoButtonsFlow.AddChild(noButton);
topToBottomFlow.AddChild(yesNoButtonsFlow);
}
break;
case MessageType.OK:
{
Button okButton = new Button("Ok");
okButton.Click += new ButtonBase.ButtonEventHandler(okButton_Click);
topToBottomFlow.AddChild(okButton);
}
break;
default:
throw new NotImplementedException();
}
topToBottomFlow.SetBoundsToEncloseChildren();
AddChild(topToBottomFlow);
IsModal = true;
}
示例15: 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);
}