WaynesButtonState class

A bundle of the four style objects that describe a single visual state of a WaynesButton — its corners, background fill, borders, and text rendering. Each button carries four parallel instances reachable as NormalState, HoverState, FocusedState, and PressedState; the button picks one at each repaint depending on the mouse / focus state.

Newly-constructed WaynesButtonState objects pre-set their BackgroundFill to a solid mid-blue and all four corners to a 15-pixel curve. Override per-state to give the button a different look in each state.

The type itself is Private Class — you reach instances only through the WaynesButton.…State properties and cannot declare a variable typed as WaynesButtonState from outside the package.

With btnGo.NormalState
    .BackgroundFill.ColorPoints.SetSolidColor vbBlue
    .TextRendering.Fill.ColorPoints.SetSolidColor vbWhite
End With

With btnGo.HoverState
    .BackgroundFill.SetSimplePattern vbBlue, &HE0E0FF, _
            Pattern:=tbGradientNorthToSouth
    .Borders.SetSimpleBorder StrokeSize:=2, ColorRGB:=vbBlue
End With

Properties

BackgroundFill

The Fill that paints the button’s background.

Borders

The Borders that draws the button’s border strokes.

Corners

The Corners that controls the per-corner shape and radius.

TextRendering

The TextRendering that controls how the button’s Caption is drawn.

Methods

InitializeDefaults

Resets the state object to the package’s defaults — solid mid-blue BackgroundFill and 15-pixel curved corners. Called automatically the first time the parent button is initialized, if no serialized data was loaded.

Syntax: object.InitializeDefaults

Events

OnChanged

Raised whenever any of the four contained style objects raises its own OnChanged. The parent WaynesButton listens for this and requests a repaint.