HypernovaDesktop Components · docs
Binarymission
WinForms › Menu Item › BinaryMenuItemManager

BinaryMenuItemManager

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

BinaryMenuItemManager is the property manager class, which lets you set various properties to be applicable across all instances of BinaryMenuItem objects.

public sealed class BinaryMenuItemManager

Remarks

BinaryMenuItem component extends the standard .NET framework MenuItem object by enabling you to set various custom colors and alpha-blending values while drawing the menu items.


Members at a glance

Properties
BlendFactorForBackgroundColorGets or sets how much of the window colour is mixed into MenuItemBackgroundColor while UseAlphaBlending is on.
BlendFactorForControlColorGets or sets how strongly MenuItemControlColor shows over the items' background while UseAlphaBlending is on.
BlendFactorForGroupHeaderBackColorNot used: group header colours are set through RedrawGroupHeaders().
BlendFactorForSelectionColorGets or sets how strongly MenuItemSelectionColor shows over the window colour while UseAlphaBlending is on.
CheckMarkAndRadioButtonColorGets or sets the color to be used in drawing the Checkmark and radio buttons in menuitems, wherever applicable.
DrawMenuSideBarUsingThisStyleGets or sets the style of rendering to use when drawing the menu item's side-bar area.
MenuItemBackgroundColorGets or sets the background colour of every BinaryMenuItem.
MenuItemBorderColorGets or sets the colour of the outline round the menu item under the pointer.
MenuItemControlColorGets or sets the BinaryMenuItem's control color.
MenuItemSelectionColorGets or sets the colour of the highlight behind the menu item under the pointer, and of pressed check marks and radio buttons.
MenuItemSelectionColorRenderingStyleGets or sets the rendering style for drawing the menu item selection rectangle area.
MenuRenderingStyleGets or sets the menu side-bar rendering style.
OrientationFactorGets or sets the orientation factor to use when drawing the menu item's side-bar using DrawMenuSideBarUsingThisStyle as MenuSideBarRenderingStyle.GradientBrushStyle and the property MenuRenderingStyle is set to MenuRenderingStyle.Custom.
UseAlphaBlendingGets or sets whether the custom/default colors used for building menuitems, will have alpha-blending enabled or not.
Methods
PerformPaintThe handler to hook into, whenever there is a need to update any changes that may have been made to the color/alphablending properties.
PerformPaintHandlerThe handler to hook into, whenever there is a need to update any changes that may have made to the color/alphablending properties.
RedrawGroupHeadersSets whether group header borders are drawn as dotted lines, on every menu item of a form – both its main menu and its context menu – and on every submenu beneath them.
RedrawGroupHeadersSets the gap between a group header and its border, on every menu item of a form – both its main menu and its context menu – and on every submenu beneath them.
RedrawGroupHeadersSets the background and border colors of every group header on a form's menus, and on every submenu beneath them.
RedrawGroupHeadersSets the background, border and text colors of every group header on a form's menus, and on every submenu beneath them.
RedrawGroupHeadersRedraws every group header on a form's menus using the colors each item already carries, which is how a change made item by item is pushed through in one pass.

Properties

BlendFactorForBackgroundColor static

public static int BlendFactorForBackgroundColor

Gets or sets how much of the window colour is mixed into MenuItemBackgroundColor while UseAlphaBlending is on.

Value
From 0 (the background colour as set) to 255 (the plain window colour). The default is 220, a near-white tint.
Remarks

Applies to menus painted after the change; call PerformPaint to repaint the form's menus.

BlendFactorForControlColor static

public static int BlendFactorForControlColor

Gets or sets how strongly MenuItemControlColor shows over the items' background while UseAlphaBlending is on.

Value
From 0 (the background colour) to 255 (the control colour as set). The default is 195.

BlendFactorForGroupHeaderBackColor static

public static int BlendFactorForGroupHeaderBackColor

Not used: group header colours are set through RedrawGroupHeaders().

Value
The default is 165. Kept for compatibility.

BlendFactorForSelectionColor static

public static int BlendFactorForSelectionColor

Gets or sets how strongly MenuItemSelectionColor shows over the window colour while UseAlphaBlending is on.

Value
From 0 (the plain window colour) to 255 (the selection colour as set). The default is 70, a pale tint.

CheckMarkAndRadioButtonColor static

public static Color CheckMarkAndRadioButtonColor

Gets or sets the color to be used in drawing the Checkmark and radio buttons in menuitems, wherever applicable.

Remarks

Typically, you can use this property when you have menuitems with MenuItem.Checked and/or MenuItem.RadioCheck properties set to true.

DrawMenuSideBarUsingThisStyle static

public static MenuSideBarRenderingStyle DrawMenuSideBarUsingThisStyle

Gets or sets the style of rendering to use when drawing the menu item's side-bar area.

Remarks

MenuItemBackgroundColor static

public static Color MenuItemBackgroundColor

Gets or sets the background colour of every BinaryMenuItem.

Value
The default is SystemColors.Control. While UseAlphaBlending is on, the getter returns the colour mixed with the window colour by BlendFactorForBackgroundColor – the colour the items are painted in.

MenuItemBorderColor static

public static Color MenuItemBorderColor

Gets or sets the colour of the outline round the menu item under the pointer.

Value
The default is SystemColors.Highlight. Not blended.

MenuItemControlColor static

public static Color MenuItemControlColor

Gets or sets the BinaryMenuItem's control color.

Remarks

Set this property to set the color of the Image bar (sidebar) in the BinaryMenuItem.

MenuItemSelectionColor static

public static Color MenuItemSelectionColor

Gets or sets the colour of the highlight behind the menu item under the pointer, and of pressed check marks and radio buttons.

Value
The default is SystemColors.Highlight. While UseAlphaBlending is on, the getter returns it mixed with the window colour by BlendFactorForSelectionColor.

MenuItemSelectionColorRenderingStyle static

public static MenuItemSelectionColorRenderingStyle MenuItemSelectionColorRenderingStyle

Gets or sets the rendering style for drawing the menu item selection rectangle area.

MenuRenderingStyle static

public static MenuRenderingStyle MenuRenderingStyle

Gets or sets the menu side-bar rendering style.

Remarks

The default value is MenuRenderingStyle.OutlookBlueTheme. Note: Setting this property to MenuRenderingStyle.None will make the DrawMenuSideBarUsingThisStyle property to use the MenuSideBarRenderingStyle.SolidBrush value.

OrientationFactor static

public static float OrientationFactor

Gets or sets the orientation factor to use when drawing the menu item's side-bar using DrawMenuSideBarUsingThisStyle as MenuSideBarRenderingStyle.GradientBrushStyle and the property MenuRenderingStyle is set to MenuRenderingStyle.Custom.

Remarks

The default value is (float) 90.0.

UseAlphaBlending static

public static bool UseAlphaBlending

Gets or sets whether the custom/default colors used for building menuitems, will have alpha-blending enabled or not.

Remarks

Alpha-blending gets you a smooth color effect while painting the menuitems. By default, this property is set to true.

Methods

PerformPaint static

public static void PerformPaint(Form mainform)

The handler to hook into, whenever there is a need to update any changes that may have been made to the color/alphablending properties.

Parameters
mainform
Ensure the sender object is always the Form object which is the parent of the BinaryMenuItem.
Remarks

This method ensures that all the menuitems will be properly redrawn with their changed color and alpha-blending properties.

PerformPaintHandler static

public static void PerformPaintHandler(object sender, EventArgs e)

The handler to hook into, whenever there is a need to update any changes that may have made to the color/alphablending properties.

Parameters
sender
Ensure the sender object is always the Form object which is the parent of the BinaryMenuItem.
e
Can be an empty EventArgs.

RedrawGroupHeaders static

public static void RedrawGroupHeaders(Form mainform, bool value)

Sets whether group header borders are drawn as dotted lines, on every menu item of a form – both its main menu and its context menu – and on every submenu beneath them.

Parameters
mainform
The form whose menus are to be restyled.
value
true to draw the border as dots, false for a solid line.

RedrawGroupHeaders static

public static void RedrawGroupHeaders(Form mainform, int value)

Sets the gap between a group header and its border, on every menu item of a form – both its main menu and its context menu – and on every submenu beneath them.

Parameters
mainform
The form whose menus are to be restyled.
value
The gap, in pixels.

RedrawGroupHeaders static

public static void RedrawGroupHeaders(Form mainform, Color backColor, Color borderColor)

Sets the background and border colors of every group header on a form's menus, and on every submenu beneath them.

Parameters
mainform
The form whose menus are to be restyled.
backColor
The header background color.
borderColor
The header border color.

RedrawGroupHeaders static

public static void RedrawGroupHeaders(Form mainform, Color backColor, Color borderColor, Color foreColor)

Sets the background, border and text colors of every group header on a form's menus, and on every submenu beneath them.

Parameters
mainform
The form whose menus are to be restyled.
backColor
The header background color.
borderColor
The header border color.
foreColor
The header text color.

RedrawGroupHeaders static

public static void RedrawGroupHeaders(Form mainform)

Redraws every group header on a form's menus using the colors each item already carries, which is how a change made item by item is pushed through in one pass.

Parameters
mainform
The form whose menus are to be redrawn.