本文整理汇总了C#中MatterHackers.Agg.UI.TextWidget类的典型用法代码示例。如果您正苦于以下问题:C# TextWidget类的具体用法?C# TextWidget怎么用?C# TextWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextWidget类属于MatterHackers.Agg.UI命名空间,在下文中一共展示了TextWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadHTML
public void LoadHTML(string htmlContent)
{
htmlContent = DoTemplateReplacements(htmlContent);
TextWidget textwdigt = new TextWidget("some test text");
textwdigt.AnchorCenter();
AddChild(textwdigt);
}
示例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: 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);
}
示例4: createPrinterNameContainer
private FlowLayoutWidget createPrinterNameContainer()
{
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.Margin = new BorderDouble(0, 5);
BorderDouble elementMargin = new BorderDouble(top: 3);
string printerNameLabelTxt = new LocalizedString("Printer Name").Translated;
string printerNameLabelTxtFull = string.Format ("{0}:", printerNameLabelTxt);
TextWidget printerNameLabel = new TextWidget(printerNameLabelTxtFull, 0, 0, 12);
printerNameLabel.TextColor = this.defaultTextColor;
printerNameLabel.HAnchor = HAnchor.ParentLeftRight;
printerNameLabel.Margin = new BorderDouble(0, 0, 0, 1);
printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);
printerNameInput.HAnchor = HAnchor.ParentLeftRight;
printerNameError = new TextWidget(new LocalizedString("Give your printer a name.").Translated, 0, 0, 10);
printerNameError.TextColor = RGBA_Bytes.White;
printerNameError.HAnchor = HAnchor.ParentLeftRight;
printerNameError.Margin = elementMargin;
container.AddChild(printerNameLabel);
container.AddChild(printerNameInput);
container.AddChild(printerNameError);
container.HAnchor = HAnchor.ParentLeftRight;
return container;
}
示例5: MenuPage
public MenuPage()
: base("Menu Controls")
{
//GuiWidget.DebugBoundsUnderMouse = true;
BackgroundColor = RGBA_Bytes.Green;
lastAction = new TextWidget("Last Menu Action");
lastAction.OriginRelativeParent = new Vector2(100, 250);
AddChild(lastAction);
Menu dropListMenu = new Menu(new TextWidget("gAction v"));
dropListMenu.Name = "ListMenu Down";
AddMenu(dropListMenu, "Walk");
AddMenu(dropListMenu, "Jog");
AddMenu(dropListMenu, "Run");
dropListMenu.OriginRelativeParent = new Vector2(100, 200);
AddChild(dropListMenu);
Menu longMenue = new Menu(new TextWidget("very long"), maxHeight: 50);
longMenue.Name = "ListMenu Down";
for (int i = 0; i < 30; i++)
{
AddMenu(longMenue, "menu {0}".FormatWith(i));
}
longMenue.OriginRelativeParent = new Vector2(100, 300);
AddChild(longMenue);
Menu raiseListMenu = new Menu(new TextWidget("jAction ^"), Direction.Up);
raiseListMenu.Name = "ListMenu Up";
AddMenu(raiseListMenu, "Walk");
AddMenu(raiseListMenu, "Jog");
AddMenu(raiseListMenu, "Run");
raiseListMenu.OriginRelativeParent = new Vector2(200, 200);
AddChild(raiseListMenu);
MenuBar mainMenu = new MenuBar();
mainMenu.VAnchor = UI.VAnchor.ParentTop;
PopupMenu popupMenu = new PopupMenu(new TextWidget("Simple Menu"));
popupMenu.OriginRelativeParent = new Vector2(100, 100);
//AddChild(popupMenu);
DropDownList dropDownList = new DropDownList("- Select Something -", RGBA_Bytes.Black, RGBA_Bytes.Gray);
dropDownList.BackgroundColor = RGBA_Bytes.Black;
dropDownList.TextColor = RGBA_Bytes.White;
dropDownList.MenuItemsPadding = new BorderDouble(13);
dropDownList.MenuItemsBorderWidth = 3;
dropDownList.MenuItemsBorderColor = RGBA_Bytes.Red;
dropDownList.MenuItemsBackgroundColor = RGBA_Bytes.Blue;
dropDownList.MenuItemsTextColor = RGBA_Bytes.White;
dropDownList.MenuItemsTextHoverColor = RGBA_Bytes.Yellow;
dropDownList.Name = "Drop Down List";
dropDownList.AddItem("Item 1", "value1");
dropDownList.AddItem("Item 2 long name");
dropDownList.AddItem("Item 3 realy long name");
dropDownList.OriginRelativeParent = new Vector2(300, 200);
AddChild(dropDownList);
}
示例6: ControlButtonViewBase
public ControlButtonViewBase(string label,
double width,
double height,
double textHeight,
double borderWidth,
double borderRadius,
double padding,
RGBA_Bytes textColor,
RGBA_Bytes fillColor,
RGBA_Bytes borderColor)
: base(width, height)
{
this.borderRadius = borderRadius;
this.borderWidth = borderWidth;
this.fillColor = fillColor;
this.borderColor = borderColor;
this.padding = padding;
TextWidget buttonText = new TextWidget(label, textHeight);
buttonText.VAnchor = VAnchor.ParentCenter;
buttonText.HAnchor = HAnchor.ParentCenter;
buttonText.TextColor = textColor;
//this.AnchorAll();
this.AddChild(buttonText);
}
示例7: PresetSelectorWidget
private int extruderIndex; //For multiple materials
public PresetSelectorWidget(string label, RGBA_Bytes accentColor, string tag, int extruderIndex)
: base(FlowDirection.TopToBottom)
{
this.extruderIndex = extruderIndex;
this.filterLabel = label;
this.filterTag = (tag == null) ? label.ToLower() : tag;
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget accentBar = new GuiWidget(7, 5)
{
BackgroundColor = accentColor,
HAnchor = HAnchor.ParentLeftRight
};
TextWidget labelText = new TextWidget(label.Localize().ToUpper())
{
TextColor = ActiveTheme.Instance.PrimaryTextColor,
HAnchor = Agg.UI.HAnchor.ParentCenter,
Margin = new BorderDouble(0, 3, 0, 6)
};
this.AddChild(labelText);
this.AddChild(GetPulldownContainer());
this.AddChild(new VerticalSpacer());
this.AddChild(accentBar);
}
示例8: SyncingPrintersPage
public SyncingPrintersPage()
: base("Close")
{
TextWidget syncingText = new TextWidget("Syncing Profiles...".Localize(),textColor: ActiveTheme.Instance.PrimaryTextColor);
syncingDetails = new TextWidget("Retrieving sync information...".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize:10);
syncingDetails.AutoExpandBoundsToText = true;
contentRow.AddChild(syncingText);
contentRow.AddChild(syncingDetails);
Progress<SyncReportType> progress = new Progress<SyncReportType>(ReportProgress);
ApplicationController.SyncPrinterProfiles("SyncingPrintersPage.ctor()", progress).ContinueWith((task) =>
{
if (!ProfileManager.Instance.ActiveProfiles.Any())
{
// Switch to setup wizard if no profiles exist
WizardWindow.ChangeToSetupPrinterForm();
}
else if (ProfileManager.Instance.ActiveProfiles.Count() == 1)
{
//Set as active printer
ActiveSliceSettings.SwitchToProfile(ProfileManager.Instance.ActiveProfiles.First().ID);
// only close the window if we are not switching to the setup printer form
UiThread.RunOnIdle(WizardWindow.Close);
}
else // multiple printers - close the window
{
UiThread.RunOnIdle(WizardWindow.Close);
}
});
footerRow.AddChild(new HorizontalSpacer());
footerRow.AddChild(cancelButton);
}
示例9: SliceSelectorWidget
private int presetIndex; //For multiple materials
public SliceSelectorWidget(string label, RGBA_Bytes accentColor, string tag = null, int presetIndex = 1)
: base(FlowDirection.TopToBottom)
{
this.presetIndex = presetIndex;
this.filterLabel = label;
if (tag == null)
{
this.filterTag = label.ToLower();
}
else
{
this.filterTag = tag;
}
this.HAnchor = HAnchor.ParentLeftRight;
this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
GuiWidget accentBar = new GuiWidget(7, 5);
accentBar.BackgroundColor = accentColor;
accentBar.HAnchor = HAnchor.ParentLeftRight;
TextWidget labelText = new TextWidget(LocalizedString.Get(label).ToUpper());
labelText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
labelText.HAnchor = Agg.UI.HAnchor.ParentCenter;
labelText.Margin = new BorderDouble(0, 3, 0, 6);
this.AddChild(labelText);
this.AddChild(GetPulldownContainer());
this.AddChild(new VerticalSpacer());
this.AddChild(accentBar);
}
示例10: CreateOptionsMenu
GuiWidget CreateOptionsMenu()
{
ImageBuffer gearImage = new ImageBuffer();
string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png");
ImageBMPIO.LoadImageData(imagePathAndFile, gearImage);
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.Margin = new BorderDouble(5, 0);
string optionsString = new LocalizedString("Options").Translated;
TextWidget optionsText = new TextWidget(optionsString, textColor: RGBA_Bytes.White);
optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter;
optionsText.Margin = new BorderDouble(0, 0, 3, 0);
leftToRight.AddChild(optionsText);
GuiWidget gearWidget = new ImageWidget(gearImage);
gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
leftToRight.AddChild(gearWidget);
leftToRight.HAnchor = HAnchor.FitToChildren;
leftToRight.VAnchor = VAnchor.FitToChildren;
Menu optionMenu = new Menu(leftToRight);
optionMenu.OpenOffset = new Vector2(-2, -10);
optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter;
optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget()));
return optionMenu;
}
示例11: createPrinterConnectionMessageContainer
public FlowLayoutWidget createPrinterConnectionMessageContainer()
{
FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
container.VAnchor = VAnchor.ParentBottomTop;
container.Margin = new BorderDouble(5);
BorderDouble elementMargin = new BorderDouble(top: 5);
string printerMessageOneText = "MatterControl will now attempt to auto-detect printer.".Localize();
TextWidget printerMessageOne = new TextWidget(printerMessageOneText, 0, 0, 10);
printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5);
printerMessageOne.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
printerMessageOne.Margin = elementMargin;
string disconnectMessage = string.Format("1.) {0} ({1}).", "Disconnect printer".Localize(), "if currently connected".Localize());
TextWidget printerMessageTwo = new TextWidget(disconnectMessage, 0, 0, 12);
printerMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
printerMessageTwo.Margin = elementMargin;
string printerMessageThreeBeg = "Power on and connect printer".Localize();
string printerMessageThreeFull = string.Format("2.) {0}.", printerMessageThreeBeg);
TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
printerMessageThree.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
printerMessageThree.Margin = elementMargin;
string printerMessageFourTxtBeg = "Press".Localize();
string printerMessageFourTxtEnd = "Connect".Localize();
string printerMessageFourTxtFull = string.Format("3.) {0} '{1}'.", printerMessageFourTxtBeg, printerMessageFourTxtEnd);
TextWidget printerMessageFour = new TextWidget(printerMessageFourTxtFull, 0, 0, 12);
printerMessageFour.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
printerMessageFour.Margin = elementMargin;
GuiWidget vSpacer = new GuiWidget();
vSpacer.VAnchor = VAnchor.ParentBottomTop;
Button manualLink = linkButtonFactory.Generate("Manual Configuration".Localize());
manualLink.Margin = new BorderDouble(0, 5);
manualLink.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortManual>();
printerErrorMessage = new TextWidget("", 0, 0, 10);
printerErrorMessage.AutoExpandBoundsToText = true;
printerErrorMessage.TextColor = RGBA_Bytes.Red;
printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
printerErrorMessage.Margin = elementMargin;
container.AddChild(printerMessageOne);
container.AddChild(printerMessageTwo);
container.AddChild(printerMessageThree);
container.AddChild(printerMessageFour);
container.AddChild(printerErrorMessage);
container.AddChild(vSpacer);
container.AddChild(manualLink);
container.HAnchor = HAnchor.ParentLeftRight;
return container;
}
示例12: 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;
}
示例13: CreateNextLine
TextWidget CreateNextLine(string startText)
{
TextWidget nextLine = new TextWidget(startText, textColor: RGBA_Bytes.White);
nextLine.Margin = new BorderDouble(0, 2);
nextLine.HAnchor = Agg.UI.HAnchor.ParentLeft;
nextLine.AutoExpandBoundsToText = true;
return nextLine;
}
示例14: CreateNextLine
private TextWidget CreateNextLine(string startText)
{
TextWidget nextLine = new TextWidget(startText, textColor: ActiveTheme.Instance.PrimaryTextColor);
nextLine.Margin = new BorderDouble(0, 2);
nextLine.HAnchor = Agg.UI.HAnchor.ParentLeft;
nextLine.AutoExpandBoundsToText = true;
return nextLine;
}
示例15: 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);
}
}