HypernovaDesktop Components · docs
Binarymission
WinForms › Smart Button › ContextMenuProperties

ContextMenuProperties

class.NET Framework 4.8Binarymission.WinForms.Controls.ButtonControls

The colours and styles a SmartButton menu button uses for its drop-down menu of BinaryMenuItem objects, edited as one expandable group in the Properties window.

public class ContextMenuProperties

Remarks

A button's settings are used while its SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true; otherwise the menu takes colours that match the button's SmartButton.XPTheme.

The menu items take their colours from the process-wide BinaryMenuItemManager, and the button writes these settings there each time its menu is prepared – so they also affect other BinaryMenuItem menus in the application.

Examples

exportButton.ButtonStyle = ButtonStyles.MenuButton;
exportButton.UseCustomDefinedPropertiesForRenderingContextMenu = true;
exportButton.ContextMenuProperties.UseGradientPainting = true;
exportButton.ContextMenuProperties.MenuSideBarRenderingColor = Color.SteelBlue;
exportButton.ContextMenuProperties.MenuItemSelectionColor = Color.LightSkyBlue;
exportButton.ContextMenuProperties.MenuItemBorderColor = Color.SteelBlue;

Members at a glance

Properties
MenuItemBackgroundColorGets or sets the background colour of the menu's items.
MenuItemBorderColorGets or sets the colour of the border drawn round the highlighted item.
MenuItemRenderingStyleGets or sets how the item under the pointer is highlighted.
MenuItemSelectionColorGets or sets the highlight colour of the item under the pointer.
MenuSideBarRenderingColorGets or sets the colour of the menu's side bar – the column behind the item images and check marks.
SmoothenSelectionColorRenderingGets or sets whether the menu's background and highlight colours are softened by blending them with the window colour.
UseGradientPaintingGets or sets whether the menu's side bar – the column behind the item images – is a gradient or a solid colour.
Methods
ToStringReturns the caption the Properties window shows for the collapsed group.

Properties

MenuItemBackgroundColor

public Color MenuItemBackgroundColor

Gets or sets the background colour of the menu's items.

Value
The default is SystemColors.Menu.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true.

MenuItemBorderColor

public Color MenuItemBorderColor

Gets or sets the colour of the border drawn round the highlighted item.

Value
The default is SystemColors.ControlText.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true.

MenuItemRenderingStyle

public MenuControls.MenuItemSelectionColorRenderingStyle MenuItemRenderingStyle

Gets or sets how the item under the pointer is highlighted.

Value
MenuItemSelectionColorRenderingStyle.Default for a flat fill in MenuItemSelectionColor with a MenuItemBorderColor border, or MenuItemSelectionColorRenderingStyle.Office for a two-tone gradient. The default is MenuItemSelectionColorRenderingStyle.Default.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true.

MenuItemSelectionColor

public Color MenuItemSelectionColor

Gets or sets the highlight colour of the item under the pointer.

Value
The default is an amber, #FFBB09.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true.

MenuSideBarRenderingColor

public Color MenuSideBarRenderingColor

Gets or sets the colour of the menu's side bar – the column behind the item images and check marks.

Value
The default is SystemColors.Control.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true. With UseGradientPainting on it is the end colour of a gradient from white.

SmoothenSelectionColorRendering

public bool SmoothenSelectionColorRendering

Gets or sets whether the menu's background and highlight colours are softened by blending them with the window colour.

Value
true to use the blended colours of the shared menu settings; false to use MenuItemBackgroundColor and MenuItemSelectionColor exactly as set. The default is true.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true.

UseGradientPainting

public bool UseGradientPainting

Gets or sets whether the menu's side bar – the column behind the item images – is a gradient or a solid colour.

Value
true for a gradient from white to MenuSideBarRenderingColor; false for solid MenuSideBarRenderingColor. The default is true.
Remarks

Applies only while the button's SmartButton.UseCustomDefinedPropertiesForRenderingContextMenu is true.

Methods

ToString

public override string ToString()

Returns the caption the Properties window shows for the collapsed group.

Returns

The text "Context menu settings...".