Table of Contents

ExButton and ExDropDownButton

ExButton is a Button that can draw itself flat in its own colors, with separate colors for the mouse and focus states. ExDropDownButton adds a drop-down menu.

Custom style

With DefaultStyle = false the button is always flat (FlatStyle.Flat) and takes its colors from ExFlatAppearance. The text of a disabled button is ForeColor faded towards BackColor (DisabledForeColor), so it stays readable on a dark background, where the system draws it almost black. With DefaultStyle = true the button keeps its designed FlatStyle and Windows draws it.

Property Description
DefaultStyle true (default) leaves the drawing to Windows, false uses the custom style.
ExFlatAppearance.BorderColor, BorderSize Border of the button.
ExFlatAppearance.MouseOverBackColor, MouseDownBackColor Background under the mouse and while pressed.
ExFlatAppearance.MouseOverBorderColor, MouseDownBorderColor, FocusBorderColor Border under the mouse, while pressed and with focus; empty keeps BorderColor.
ExFlatAppearance.CheckedBackColor Background of a checked button.
DisabledForeColor Text color of a disabled button in the custom style (read only).

ExFlatAppearance.BorderColor returns the original color also while the hover, pressed or focus color is shown.

ExDropDownButton.DropDownMenu is a ContextMenuStrip that opens under the button on a left click, or under the cursor with ShowMenuUnderCursor. The arrow has its own ArrowColor and DisabledArrowColor. The theme of the button applies to the menu too, if a handler for ContextMenuStrip is registered.

Theme

Theme color Used for
ButtonBackColor, ButtonForeColor Background and text.
BorderColor Border.
HighlightBackColor Background under the mouse and while pressed, border with focus.

Example

var export = new ExDropDownButton { Text = "Export", DropDownMenu = exportMenu };
export.ExFlatAppearance.BorderSize = 1;
ExThemer.Apply(export, darkTheme);

API