Class SmartButton
BinarySmartButton .NET control is an extended and feature-rich replacement for the standard .NET Framework Button control.
Implements
Namespace: Binarymission.WinForms.Controls.ButtonControls
Assembly: Binarymission.WinForms.Controls.BinarySmartButton.dll
Syntax
public class SmartButton : Control
Remarks
BinarySmartButton .NET offers the following rich features:
1. "XP-theme" style UI: The control presents its UI with the XP theme style look.
2. Support for displaying icon images with Alpha-channel information: You can now set button images with Icons without losing its alpha-channel information.
The standard .NET button control does not directly support displaying Icons with alpha-channel. Moreover, .NET standard button control does not display images when its FlatStyle is set to "System" in order to enable themed look.
BinarySmartButton presents its UI with XP themed look, also displaying icon images without losing the icon's alpha-channel information.
3. Menu Button style: The control supports a special MenuButton style. When set with this style, you can assign a set of MenuItems to the control, and the control will automatically display a drop-down menu just below the control so as to let your users choose a command from a list of numerous possible commands. This feature extends the button control's functionality by making a variety of commands to choose from and execute, instead of the traditional "one command" button functionality.
The control's drop-down menu can be displayed using our popular BinaryMenuItem .NET control that comes with this .NET assembly. This menu control lets you display Images and text in the drop-down menu along with the ever popular "Visual Studio .NET" style menu.
Alternatively, you could also simply use the standard
Either way, all you need to do is to set the ButtonStyle to MenuButton style and set the DropDownMenuItems property to array of your defined BinaryMenuItem .NET control or
Please refer to the detailed C# .NET sample demonstration program source code that accompanies the control package, to see how to use the various features of this control.
Constructors
SmartButton()
Initializes a new instance of BinarySmartButton control.
Declaration
public SmartButton()
Properties
BorderColor
Gets or sets the color of the border.
Declaration
public Color BorderColor { get; set; }
Remarks
Applicable only when the IsRenderingTheme property is set to false.
ButtonStyle
Gets or sets the button style.
Declaration
public ButtonStyles ButtonStyle { get; set; }
Remarks
Set this property with one of the valid styles from the ButtonStyles enumeration.
DefaultTheme
Gets or sets whether to use the default active theme.
Declaration
public bool DefaultTheme { get; set; }
Remarks
If the current Operating System is Windows XP, then setting this property to true will use the current default XP theme as used in the machine.
Otherwise, the default XP theme to emulate is taken as Blue theme, unless you have set the XPTheme property value to a particular XP theme value.
The default value is true.
DialogResult
Implements IButtonControl.DialogResult property.
Declaration
public DialogResult DialogResult { get; set; }
DrawFocusRectangle
Gets or sets whether a focus rectangle needs to be drawn when the button control is in focus.
Declaration
public bool DrawFocusRectangle { get; set; }
Remarks
The default is false.
DrawMenuButtonSeparator
Gets or sets a value indicating whether to draw the menu button separator.
Declaration
public bool DrawMenuButtonSeparator { get; set; }
DropDownArrowMarkColor
Gets or sets the color of the drop-down arrow mark image that is displayed at the far right corner of the control, when the control is set to "ButtonStyles.MenuButton" style.
Declaration
public Color DropDownArrowMarkColor { get; set; }
Remarks
The default value is ControlText value.
DropDownMenuItems
Gets or sets the drop-down menu object of the control.
Declaration
public ToolStripItem[] DropDownMenuItems { get; set; }
Remarks
When the control is set to "ButtonStyles.MenuButton" style, the control can display a drop-down menu on the control's KeyDown and MouseDown events.
You will need to set this property with an array of
Note: This property cannot be set from the VS.NET property editor.
You will have to create an array of either
It is advisable to do this in your Form's Load event. For an example, please refer to the sample demonstration code that is installed in the control's installation folder.
DropDownMenuRendererTheme
Declaration
public DropDownMenuRendererThemeKind DropDownMenuRendererTheme { get; set; }
EndColor
Gets or sets the end color.
Declaration
public Color EndColor { get; set; }
ForeColor
Gets or sets the control's text forecolor.
Declaration
public Color ForeColor { get; set; }
Remarks
The default value is ControlText value.
Icon
Gets or sets the Icon that is displayed on the control.
Declaration
public Icon Icon { get; set; }
Remarks
BinarySmartButton control can display Icon images without losing its alpha-channel information.
This means that you can display 32-bit Icon objects which has the alpha-channel information (for e.g. drop-shadow information).
Only Icon objects are supported for displaying images with the drop-shadow effects (alpha-channel).
Note: When this property is set to a valid Icon object, the
Image
Gets or sets the Image that is displayed on the control.
Declaration
public Image Image { get; set; }
Remarks
Only Icon objects are supported for displaying the images with drop-shadow effects (alpha-channel).
Note: When this property is set to a valid Image object, the
IsRenderingTheme
Gets or sets a value indicating whether the control is rendering one of the built-in themes.
Declaration
public bool IsRenderingTheme { get; set; }
LinearGradientRenderingAngle
Gets or sets the linear gradient rendering angle.
Declaration
public float LinearGradientRenderingAngle { get; set; }
MenuButtonSeparatorColor
Gets or sets the color of the menu button separator.
Declaration
public Color MenuButtonSeparatorColor { get; set; }
MenuButtonSeparatorLineHeight
Declaration
public int MenuButtonSeparatorLineHeight { get; set; }
MenuStripColorTable
Gets or sets a custom ProfessionalColorTable class that also implements IMenuStripColorTable.
Declaration
public IMenuStripColorTable MenuStripColorTable { get; set; }
Remarks
If you want to supply custom colors and property values for the Control to render its DropDownMenuItems, then use this property to supply a custom implementation that implements both ProfessionalColorTable class and also Binarymission's IMenuStripColorTable interface.
PushedEndColor
Gets or sets the end color for the pushed state of the control.
Declaration
public Color PushedEndColor { get; set; }
PushedStartColor
Gets or sets the start color for the pushed state of the control.
Declaration
public Color PushedStartColor { get; set; }
ShowDropDownArrow
Gets or sets whether to display a drop-down arrow mark when the control is set to "ButtonStyles.MenuButton" style.
Declaration
public bool ShowDropDownArrow { get; set; }
Remarks
The default value is true.
StartColor
Gets or sets the start color.
Declaration
public Color StartColor { get; set; }
Text
Gets or sets the text string that is displayed on the control.
Declaration
public override string Text { get; set; }
TextStringFormat
Gets or sets the user defined text string format to use.
Declaration
public StringFormat TextStringFormat { get; set; }
TransparentColor
Declaration
public Color TransparentColor { get; set; }
UseCustomDefinedPropertiesForRenderingContextMenu
Gets or sets a value indicating whether to use custom defined properties for rendering context menu.
Declaration
public bool UseCustomDefinedPropertiesForRenderingContextMenu { get; set; }
UseCustomTextStringFormat
Gets or sets a value indicating whether to use custom text string format.
Declaration
public bool UseCustomTextStringFormat { get; set; }
UseUserDefinedColorForArrowMark
Gets or sets a value indicating whether to use user defined color for Arrow mark..
Declaration
public bool UseUserDefinedColorForArrowMark { get; set; }
UseUserDefinedColorForMenuButtonSeparator
Gets or sets a value indicating whether to use user defined color for menu button separator.
Declaration
public bool UseUserDefinedColorForMenuButtonSeparator { get; set; }
XPTheme
Gets or sets the XP theme to emulate while drawing the control.
Declaration
public XPThemes XPTheme { get; set; }
Remarks
Set this property with one of the valid XP themes from the XPThemes enumeration.
The default value is "XPThemes.Blue".
Methods
add_OnAboutToTheShowContextMenuOnMenuButton(AboutToTheShowContextMenuOnMenuButton)
Declaration
public void add_OnAboutToTheShowContextMenuOnMenuButton(AboutToTheShowContextMenuOnMenuButton value)
Parameters
Type | Name | Description |
---|---|---|
AboutToTheShowContextMenuOnMenuButton | value |
Dispose(Boolean)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
NotifyDefault(Boolean)
Implements IButtonControl.NotifyDefault method.
Declaration
public void NotifyDefault(bool value)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value |
OnClick(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnClick(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnEnter(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnHandleCreated(EventArgs)
Declaration
protected override void OnHandleCreated(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnKeyDown(KeyEventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnKeyDown(KeyEventArgs ke)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | ke |
OnKeyUp(KeyEventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnKeyUp(KeyEventArgs ke)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | ke |
OnLeave(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnMouseDown(MouseEventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e |
OnMouseEnter(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnMouseEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnMouseLeave(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnMouseMove(MouseEventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e |
OnMouseUp(MouseEventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e |
OnPaint(PaintEventArgs)
Overridden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnPaint(PaintEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
PaintEventArgs | e |
OnParentChanged(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnParentChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnSizeChanged(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnSizeChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnSystemColorsChanged(EventArgs)
Refer to base class documentation.
Declaration
protected override void OnSystemColorsChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
OnTextChanged(EventArgs)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override void OnTextChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e |
PerformClick()
Implements IButtonControl.PerformClick method.
Declaration
public void PerformClick()
ProcessMnemonic(Char)
Overriden implementation. Kindly refer the base class (Controldocumentation.
Declaration
protected override bool ProcessMnemonic(char charCode)
Parameters
Type | Name | Description |
---|---|---|
Char | charCode |
Returns
Type | Description |
---|---|
Boolean |
remove_OnAboutToTheShowContextMenuOnMenuButton(AboutToTheShowContextMenuOnMenuButton)
Declaration
public void remove_OnAboutToTheShowContextMenuOnMenuButton(AboutToTheShowContextMenuOnMenuButton value)
Parameters
Type | Name | Description |
---|---|---|
AboutToTheShowContextMenuOnMenuButton | value |
WndProc(ref Message)
Processes Windows messages.
Declaration
protected override void WndProc(ref Message m)
Parameters
Type | Name | Description |
---|---|---|
Message | m | The Windows Message to process. |
Events
OnAboutToTheShowContextMenuOnMenuButton
A specialized event that is raised just when the user clicks on the control (when it is of type MenuButton) and the assigned context menu is about to be shown.
Declaration
public event AboutToTheShowContextMenuOnMenuButton OnAboutToTheShowContextMenuOnMenuButton
Event Type
Type | Description |
---|---|
AboutToTheShowContextMenuOnMenuButton |
Remarks
Refer to the delegate AboutToTheShowContextMenuOnMenuButton documentation for more details.