HeaderPane
Main
Hide

SftButton/DLL 3.0 - Button Control

Share Link
Print

Colors and Gradients

SftButton supports solid and two-color gradient backgrounds for every rendering state. Colors are specified per state through the SFTBUTTON_CONTROL structure.

Per-state background colors

StateSolidGradient (start, end)
NormalcolorBgcolorBgStart, colorBgEnd
HovercolorBgHovercolorBgHoverStart, colorBgHoverEnd
Focus (button has keyboard focus)colorBgFocuscolorBgFocusStart, colorBgFocusEnd
PressedcolorBgPressed-

Solid vs gradient

If both gradient endpoints (colorBgStart / colorBgEnd, etc.) are valid colors, the background is rendered as a gradient between them and the solid color is ignored. If either endpoint is SFTBUTTON_NOCOLOR, the solid color is used instead. nFillOrientation selects gradient direction: SFT_ORIENTATION_HORZ (left to right) or SFT_ORIENTATION_VERT (top to bottom, default).

Any color field can be set to SFTBUTTON_NOCOLOR to request "transparent" / "system default" behavior - the control uses the appropriate system or palette color.

Foreground colors

colorFg is the text color for the normal and hover states. colorFgPressed replaces it when the button is pressed; colorFgGrayed replaces it when the button is disabled. colorFgDownArrow is the dropdown-arrow color (or SFTBUTTON_NOCOLOR for the system default). See Text and Fonts.

Border and 3D edge colors

colorDarkEdge, colorLightEdge, colorShadowEdge and colorWhiteEdge control the four facets of the 3D edge that SFTBUTTON_BORDER_STANDARD draws. Each field can be SFTBUTTON_NOCOLOR to use the system default. See Borders.

Outside background

colorBgOutside is the color of the area surrounding the button rectangle when the button is smaller than its window (or has been auto-sized). It is rarely set explicitly; the default of SFTBUTTON_NOCOLOR uses the parent's background.

Theme, dark mode, high contrast

When themes are active (nUseThemes is SFTBUTTON_THEME_YES), Windows paints the background and border; caller-supplied background colors are ignored. When dark mode is active, caller colors are honored - the application's chosen colors still win over the dark palette default. When Windows High Contrast is active, caller colors are ignored and the user's contrast theme wins (see High Contrast).

Accent colors that work in both light and dark modes use channels in the RGB 30-210 range; pure-channel values (0 or 255) often read poorly in one mode or the other.


Last Updated 04/25/2026 - (email)
© 2026 Softel vdm, Inc.