Class SpeedButton
Implements speed button control.
[ControlCategory("Other")]
public class SpeedButton : GraphicControl, IBaseObjectWithId, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo, ICommandSource
- Inheritance
-
SpeedButton
- Implements
- Derived
Examples
Here is how to declare a SpeedButton in UIXML:
<SpeedButton Name="button1" Click="Button_Click" HorizontalAlignment="Right"
ToolTip = "Some hint" Shortcut="Ctrl+O" Text="Ok" TextVisible="true"/>
Also, a SpeedButton can be created from code:
public SpeedButton CreateSpeedButton()
{
SpeedButton result = new()
{
Text = "Cancel",
TextVisible = true,
ToolTip = "Some hint",
Parent = buttonPanel,
ShortcutKeys = Keys.Control | Keys.A,
Name = "cancelBtn",
Enabled = false,
HorizontalAlignment = HorizontalAlignment.Right,
};
result.ImageSet = KnownSvgImages.ImgCancel.AsNormal(32, result.IsDarkBackground);
result.DisabledImageSet = KnownSvgImages.ImgCancel.AsDisabled(32, result.IsDarkBackground);
result.Click += Button_Click;
return result;
}
Remarks
Example of how a SpeedButton can look:
Constructors
- SpeedButton()
Initializes a new instance of the SpeedButton class.
- SpeedButton(Control)
Initializes a new instance of the SpeedButton class.
Fields
- DefaultClickRepeatDelay
Gets or sets default click repeat delay used when IsClickRepeated is True.
- DefaultCustomTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to Custom.
- DefaultImageLabelDistance
Gets or sets default image and label distance in the SpeedButton.
- DefaultPadding
Gets or sets default padding in the SpeedButton.
- DefaultStickyBorderWidth
Gets or sets default border width of the SpeedButton in the sticky state.
- DefaultTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to Default.
- DefaultUseTheme
Gets ot sets default value of UseTheme property.
- DefaultUseThemeForSticky
Gets ot sets default value of UseThemeForSticky property.
- NoBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to NoBorder.
- StaticBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to StaticBorder.
- StickyBorderTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to StickyBorder.
- TabControlTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to TabControl.
Properties
- AllChildrenInLayout
Gets all child controls which are visible and included in the layout.
- BorderColor
Gets or sets border color override. Currently is not implemented. Added for the compatibility with legacy code.
- ClickAction
Gets or sets Action which will be executed when this control is clicked by the user.
- ClickRepeatDelay
Gets or sets click repeat delay used when IsClickRepeated is True.
- Command
The command that will be executed when the class is "invoked". Classes that implement this interface should enable or disable based on the command's CanExecute(object?) return value.
- CommandParameter
Gets the parameter that will be passed to the command when executing it.
- CommandTarget
An element that an implementor may wish to target as the destination for the command. The property may be implemented as read-write if desired.
- CustomTheme
Gets or sets default color and style settings for all SpeedButton controls which have UseTheme equal to Custom.
- DefaultShortcutToolTipTemplate
Gets or sets default template for the shortcut when it is shown in the tooltip.
- DisabledImage
Gets or sets the disabled image that is displayed by the control.
- DisabledImageSet
Gets or sets the disabled ImageSet that is displayed by the control.
- Enabled
Gets or sets a value indicating whether the control can respond to user interaction.
- Font
Gets or sets the font of the text displayed by the control.
- HasImage
Gets whether control has image and it is visible.
- HideToolTipOnClick
Gets or sets whether ToolTip will be hidden when control is clicked. Default is
true
.
- Image
Gets or sets the image that is displayed by the control.
- ImageHorizontalAlignment
Gets or sets horizontal alignment of the image.
- ImageLabelDistance
Gets or sets distance between image and label.
- ImageToText
Gets or sets a value which specifies label and control alignment.
- ImageVerticalAlignment
Gets or sets vertical alignment of the image.
- ImageVisible
Gets or sets a value indicating whether to draw image.
- IsBold
Gets or sets whether font style override is bold.
- IsClickRepeated
Gets or sets whether mouse clicks are repeated continiously while left mouse button is pressed.
- LabelHorizontalAlignment
Gets or sets horizontal alignment of the label.
- LabelVerticalAlignment
Gets or sets vertical alignment of the label.
- Shortcut
Gets or sets a value indicating the associated shortcut key.
- ShortcutInfo
Gets or sets a value indicating the associated shortcut key.
- ShortcutKeyInfo
Gets or sets a value indicating the associated shortcut key.
- ShortcutKeys
Gets or sets the associated shortcut keys.
- ShortcutToolTipTemplate
Gets or sets template for the shortcut when it is shown in the tooltip.
- Sticky
Gets or sets whether control is sticky.
- StickyToggleOnClick
Gets or sets whether Sticky is toggled when control is clicked.
- StickyVisualStateOverride
Gets or sets override for VisualState when Sticky is True.
- Text
Gets or sets the text associated with this control.
- TextVisible
Gets or sets whether to display text in the control.
- UseDefaultTheme
Gets or sets whether to use DefaultTheme.
- UseTheme
Gets or sets whether to use DefaultTheme.
- UseThemeForSticky
Gets or sets color theme when Sticky is True.
- VisualState
Gets current VisualControlState.
Methods
- CreateBorders(Color)
Creates borders for the SpeedButton using default border width and using specified
color
.
- DefaultPaint(PaintEventArgs)
Default painting method of the UserControl and its descendants.
- DisposeManaged()
Override to dispose managed resources. Here we dispose all used object references.
- GetDefaultTheme()
Gets default color and style settings.
- GetRealToolTip()
Gets ToolTip value for use in the native control.
- GetShortcuts()
Adds list of shortcuts associated with the control and its child controls. Only visible and enabled child controls are queried.
- InitThemeDark(ControlStateSettings)
Initializes default colors and styles for the SpeedButton using 'Dark' color theme.
- InitThemeLight(ControlStateSettings)
Initializes default colors and styles for the SpeedButton using 'Light' color theme.
- LoadSvg(string, SizeI)
Loads normal and disabled image from the specified file or resource url. Loaded images assigned to ImageSet and DisabledImageSet properties.
- OnClick(EventArgs)
Called when the control is clicked.
- OnMouseDown(MouseEventArgs)
Called when the mouse button was pressed.
- OnVisualStateChanged(EventArgs)
Called when VisualStateChanged property is changed.
- RaiseFontChanged(EventArgs)
Raises the FontChanged event and calls OnFontChanged(EventArgs) method.