'Declaration Public Class UltraButton Inherits UltraButtonBase Implements Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.IImageListProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.Touch.ISupportTouchMetrics, Infragistics.Win.UIAutomation.IProvideUIAutomation
public class UltraButton : UltraButtonBase, Infragistics.Win.AppStyling.ISupportAppStyling, Infragistics.Win.IImageListProvider, Infragistics.Win.IUltraControl, Infragistics.Win.IUltraControlElement, Infragistics.Win.Touch.ISupportTouchMetrics, Infragistics.Win.UIAutomation.IProvideUIAutomation
The UltraButton is a standard windows button control and may be clicked using the mouse or keyboard (using the SPACE or ENTER keys).
Set the AcceptButton or CancelButton property of a Form to the button to allow the click event to be invoked using the ENTER or ESC keys respectively even if the button does not have focus.
When the form containing the UltraButton is displayed using the form's ShowDialog method, the System.Windows.Forms.DialogResult property of the button may be used to specify the return value of the ShowDialog method.
The UltraButton has much of the same functionality as the inbox Button control with some additional features including the ability to fire the click event repeatedly while the button is pressed (AutoRepeat) and the ability to be displayed with non-rectangular shapes (ShapeImage). The default appearance of the button can be modified using the Appearance property. The HotTrackAppearance can be used to adjust the appearance of the button when the mouse is positioned over the button when ControlBase.UseHotTracking is set to true. The UltraButtonBase.PressedAppearance affects the appearance of the button when the button is pressed.
Note If the control that has focus accepts and processes the ENTER or ESC key, the UltraButton will not process it.
Note If the operating system supports themes and Infragistics.Win.UltraControlBase.SupportThemes is true, the appearance of the control will be rendered using those these and will not use the colors specified in the associated appearance properties.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.Misc Private Sub InitializeDialogButtons() Me.btnCancel.Text = "&Cancel" Me.btnCancel.DialogResult = DialogResult.Cancel Me.CancelButton = Me.btnCancel Me.btnOk.Text = "OK" Me.btnOk.DialogResult = DialogResult.OK Me.AcceptButton = Me.btnOk End Sub Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click Dim allowClose As Boolean = True 'process the ok click If Not allowClose Then 'clear the dialog result so it won't close Me.DialogResult = DialogResult.None Else Me.Close() End If End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click 'cancel and close Me.Close() End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.Misc; private void InitializeDialogButtons() { this.btnCancel.Text = "&Cancel"; this.btnCancel.DialogResult = DialogResult.Cancel; this.CancelButton = this.btnCancel; this.btnOk.Text = "OK"; this.btnOk.DialogResult = DialogResult.OK; this.AcceptButton = this.btnOk; } private void btnOk_Click(object sender, System.EventArgs e) { bool allowClose = true; //process the ok click if (!allowClose) { //clear the dialog result so it won't close this.DialogResult = DialogResult.None; } else this.Close(); } private void btnCancel_Click(object sender, System.EventArgs e) { //cancel and close this.Close(); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2