本文整理汇总了C#中MatterHackers.Agg.UI.Button类的典型用法代码示例。如果您正苦于以下问题:C# Button类的具体用法?C# Button怎么用?C# Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于MatterHackers.Agg.UI命名空间,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupStepInstallDriver
public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
this.printerDriverFilePath = this.PrinterSetupStatus.DriverFilePath;
headerLabel.Text = string.Format(new LocalizedString("Install Communication Driver").Translated);
printerDriverContainer = createPrinterDriverContainer();
contentRow.AddChild(printerDriverContainer);
{
//Construct buttons
installButton = textImageButtonFactory.Generate(new LocalizedString("Install Driver").Translated);
installButton.Click += new ButtonBase.ButtonEventHandler(installButton_Click);
skipButton = textImageButtonFactory.Generate(new LocalizedString("Skip").Translated);
skipButton.Click += new ButtonBase.ButtonEventHandler(skipButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(installButton);
footerRow.AddChild(skipButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例2: getThemeButton
public Button getThemeButton(int index)
{
GuiWidget normal = new GuiWidget(colorSelectSize, colorSelectSize);
normal.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
GuiWidget hover = new GuiWidget(colorSelectSize, colorSelectSize);
hover.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
GuiWidget pressed = new GuiWidget(colorSelectSize, colorSelectSize);
pressed.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].secondaryAccentColor;
GuiWidget disabled = new GuiWidget(colorSelectSize, colorSelectSize);
Button colorButton = new Button(0, 0, new ButtonViewStates(normal, hover, pressed, disabled));
colorButton.Name = index.ToString();
colorButton.Click += (sender, mouseEvent) =>
{
UserSettings.Instance.set("ActiveThemeIndex", ((GuiWidget)sender).Name);
ActiveTheme.Instance.LoadThemeSettings(int.Parse(((GuiWidget)sender).Name));
};
colorButton.MouseEnterBounds += (sender, mouseEvent) =>
{
colorToChangeTo.BackgroundColor = ActiveTheme.Instance.AvailableThemes[index].primaryAccentColor;
};
colorButton.MouseLeaveBounds += (sender, mouseEvent) =>
{
colorToChangeTo.BackgroundColor = ActiveTheme.Instance.PrimaryAccentColor;
};
return colorButton;
}
示例3: SetupStepComPortManual
public SetupStepComPortManual()
{
FlowLayoutWidget printerComPortContainer = createComPortContainer();
contentRow.AddChild(printerComPortContainer);
//Construct buttons
nextButton = textImageButtonFactory.Generate("Done".Localize());
nextButton.Click += (s, e) => UiThread.RunOnIdle(Parent.Close);
nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate("Connect".Localize());
connectButton.Click += ConnectButton_Click;
refreshButton = textImageButtonFactory.Generate("Refresh".Localize());
refreshButton.Click += (s, e) => UiThread.RunOnIdle(WizardWindow.ChangeToPage<SetupStepComPortManual>);
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(connectButton);
footerRow.AddChild(refreshButton);
footerRow.AddChild(new HorizontalSpacer());
footerRow.AddChild(cancelButton);
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
}
示例4: AddChildElements
protected override void AddChildElements()
{
actionBarButtonFactory.invertImageLocation = false;
string connectString = new LocalizedString("Connect").Translated;
connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png");
connectPrinterButton.Margin = new BorderDouble(3, 0);
connectPrinterButton.VAnchor = VAnchor.ParentCenter;
connectPrinterButton.Cursor = Cursors.Hand;
string disconnectString = new LocalizedString("Disconnect").Translated;
disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png");
disconnectPrinterButton.Margin = new BorderDouble(3, 0);
disconnectPrinterButton.VAnchor = VAnchor.ParentCenter;
disconnectPrinterButton.Visible = false;
disconnectPrinterButton.Cursor = Cursors.Hand;
selectActivePrinterButton = new PrinterSelectButton();
selectActivePrinterButton.HAnchor = HAnchor.ParentLeftRight;
selectActivePrinterButton.Cursor = Cursors.Hand;
actionBarButtonFactory.invertImageLocation = true;
this.AddChild(connectPrinterButton);
this.AddChild(disconnectPrinterButton);
this.AddChild(selectActivePrinterButton);
this.AddChild(CreateOptionsMenu());
}
示例5: SetupStepComPortTwo
public SetupStepComPortTwo(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
startingPortNames = SerialPort.GetPortNames();
contentRow.AddChild(createPrinterConnectionMessageContainer());
{
//Construct buttons
nextButton = textImageButtonFactory.Generate(new LocalizedString("Done").Translated);
nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate(new LocalizedString("Connect").Translated);
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(connectButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例6: 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();
}
示例7: SetupStepMakeModelName
public SetupStepMakeModelName(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinter = null)
: base(windowController, containerWindowToClose, setupPrinter)
{
//Construct inputs
printerNameContainer = createPrinterNameContainer();
printerMakeContainer = createPrinterMakeContainer();
printerModelContainer = createPrinterModelContainer();
//Add inputs to main container
contentRow.AddChild(printerNameContainer);
contentRow.AddChild(printerMakeContainer);
contentRow.AddChild(printerModelContainer);
//Construct buttons
nextButton = textImageButtonFactory.Generate(new LocalizedString("Save & Continue").Translated);
nextButton.Click += new ButtonBase.ButtonEventHandler(NextButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
SetElementState();
}
示例8: SetupStepInstallDriver
public SetupStepInstallDriver(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
this.driversToInstall = this.currentPrinterSetupStatus.DriversToInstall;
headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
printerDriverContainer = createPrinterDriverContainer();
contentRow.AddChild(printerDriverContainer);
{
//Construct buttons
installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
installButton.Click += (sender, e) =>
{
UiThread.RunOnIdle(installButton_Click);
};
skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
skipButton.Click += new EventHandler(skipButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(installButton);
footerRow.AddChild(skipButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例9: SetupStepInstallDriver
public SetupStepInstallDriver(ConnectionWizard windowController)
: base(windowController)
{
headerLabel.Text = string.Format(LocalizedString.Get("Install Communication Driver"));
printerDriverContainer = createPrinterDriverContainer();
contentRow.AddChild(printerDriverContainer);
{
//Construct buttons
installButton = textImageButtonFactory.Generate(LocalizedString.Get("Install Driver"));
installButton.Click += (sender, e) =>
{
UiThread.RunOnIdle(() =>
{
bool canContinue = this.InstallDriver();
if (canContinue)
{
connectionWizard.ChangeToSetupBaudOrComPortOne();
}
});
};
skipButton = textImageButtonFactory.Generate(LocalizedString.Get("Skip"));
skipButton.Click += (s, e) => connectionWizard.ChangeToSetupBaudOrComPortOne();
//Add buttons to buttonContainer
footerRow.AddChild(installButton);
footerRow.AddChild(skipButton);
footerRow.AddChild(new HorizontalSpacer());
footerRow.AddChild(cancelButton);
}
}
示例10: SetupStepComPortManual
public SetupStepComPortManual(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus setupPrinterStatus)
: base(windowController, containerWindowToClose, setupPrinterStatus)
{
linkButtonFactory.fontSize = 8;
FlowLayoutWidget printerComPortContainer = createComPortContainer();
contentRow.AddChild(printerComPortContainer);
{
//Construct buttons
nextButton = textImageButtonFactory.Generate(LocalizedString.Get("Done"));
nextButton.Click += new EventHandler(NextButton_Click);
nextButton.Visible = false;
connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
connectButton.Click += new EventHandler(ConnectButton_Click);
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh"));
refreshButton.Click += new EventHandler(RefreshButton_Click);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
footerRow.AddChild(connectButton);
footerRow.AddChild(refreshButton);
footerRow.AddChild(hSpacer);
footerRow.AddChild(cancelButton);
}
}
示例11: CreateButton
private void CreateButton(HAnchor hAnchor, VAnchor vAnchor)
{
Button anchorButton = new Button(hAnchor.ToString() + " " + vAnchor.ToString());
anchorButton.HAnchor = hAnchor;
anchorButton.VAnchor = vAnchor;
anchorButton.Margin = new BorderDouble(offset);
AddChild(anchorButton);
}
示例12: PlayfieldView
public PlayfieldView(RectangleDouble bounds)
{
BoundsRelativeToParent = bounds;
GameImageSequence menuButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "MenuButtonFromGame");
Button menuButton = new Button(400, 12, new ButtonViewThreeImage(menuButtonSequence.GetImageByIndex(0), menuButtonSequence.GetImageByIndex(1), menuButtonSequence.GetImageByIndex(2)));
AddChild(menuButton);
menuButton.Click += new Button.ButtonEventHandler(EscapeMenu);
}
示例13: CreateButton
private void CreateButton(HAnchor hAnchor, VAnchor vAnchor)
{
Button anchorButton = new Button(hAnchor.ToString() + " - " + vAnchor.ToString());
anchorButton.BackgroundColor = RGBA_Bytes.Red;
anchorButton.HAnchor = hAnchor;
anchorButton.VAnchor = vAnchor;
anchorButton.Margin = new BorderDouble(offset);
AddChild(anchorButton);
}
示例14: CreditsMenu
public CreditsMenu(RectangleDouble bounds)
{
BoundsRelativeToParent = bounds;
GameImageSequence cancelButtonSequence = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "NumPlayersCancelButton");
Button cancelGameButton = new Button(400, 200, new ButtonViewThreeImage(cancelButtonSequence.GetImageByIndex(0), cancelButtonSequence.GetImageByIndex(1), cancelButtonSequence.GetImageByIndex(2)));
AddChild(cancelGameButton);
cancelGameButton.Click += new Button.ButtonEventHandler(OnCancelMenuButton);
}
示例15: SplitButton
public SplitButton(string buttonText, Direction direction = Direction.Down)
: base(FlowDirection.LeftToRight, HAnchor.FitToChildren, VAnchor.FitToChildren)
{
defaultButton = CreateDefaultButton(buttonText);
altChoices = CreateDropDown(direction);
defaultButton.VAnchor = VAnchor.ParentCenter;
AddChild(defaultButton);
AddChild(altChoices);
}