Borders class

The collection of border strokes drawn around a region. Each stroke is an independent Border sub-object with its own thickness, fill, and blending behaviour, layered in source order. A single thin black outline is a one-element collection — easiest constructed by calling SetSimpleBorder.

Accessed as <state>.Borders, CellRenderingOptions.Borders, and the slider’s <sliderState>.BackgroundBorders / BlockBorders. The array of Border sub-objects on a TextRendering’s Outlines member uses the same element type.

btnGo.NormalState.Borders.SetSimpleBorder StrokeSize:=1, ColorRGB:=vbBlack

An element already in the array is reached through Elements and restyled in place:

btnGo.NormalState.Borders.SetSimpleBorder StrokeSize:=4, ColorRGB:=vbBlack
btnGo.NormalState.Borders.Elements(0).BlendWithBackgroundFill = True

Layered borders — multiple Border instances stroked in order — are assigned to the Elements array directly. Each element can have its own StrokeSize and its own Fill, so a thin black outline can sit on top of a wide coloured band, or three bands of different colours can stack into a “shadow”:

Dim elems(0 To 2) As CustomControlsPackage.Border
Set elems(0) = New CustomControlsPackage.Border
elems(0).StrokeSize = 4
elems(0).Fill.ColorPoints.SetSolidColor vbBlack
Set elems(1) = New CustomControlsPackage.Border
elems(1).StrokeSize = 7
elems(1).Fill.ColorPoints.SetSolidColor &H99CCFF       ' light blue band
Set elems(2) = New CustomControlsPackage.Border
elems(2).StrokeSize = 4
elems(2).Fill.ColorPoints.SetSolidColor &H4D7AB4       ' deeper blue
btnGo.NormalState.Borders.Elements = elems

Important

Border is a Private component of the package, so naming it takes two things: the CustomControlsPackage library symbol prefixed with an asterisk in Project Settings — the control package, not the CustomControls DESIGNER library listed beside it — and the package qualifier used above. See Exposing a library’s private symbols for the setting and where to find it. Without the asterisk neither Border nor CustomControlsPackage.Border resolves; with it, only the qualified form does.

Nothing else on this page needs it. SetSimpleBorder and restyling an element already in Elements work in an ordinary project.

A single Border can also display a gradient instead of a solid colour — assign a multi-stop Fill to its Fill member. Set BlendWithBackgroundFill to True on a translucent border to make it tint with the control’s own BackgroundFill rather than with whatever lies under the control.

Properties

Elements

The array of Border sub-objects, drawn in order from index 0 outward. Read-write; assigning it needs a Border() array, which the project can only declare when the package is imported with an asterisk — see the note at the top of this page. Otherwise the array is populated through SetSimpleBorder or SetSimpleBorderRGBA, and the elements already in it are adjusted in place.

Methods

SetSimpleBorder

Replaces the Elements array with a single border stroke of the given thickness and fully-opaque colour.

Syntax: object.SetSimpleBorder StrokeSize, ColorRGB

StrokeSize
required A Long giving the stroke thickness in pixels.
ColorRGB
required A Long RGB colour for the stroke fill.

SetSimpleBorderRGBA

Replaces the Elements array with a single border stroke whose alpha is taken from the supplied ColorRGBA rather than forced opaque. Useful for transparent borders that are present only as visual padding (the slider uses a fully transparent border on the BlockBorders to indent the block inside the background).

Syntax: object.SetSimpleBorderRGBA StrokeSize, ColorRGBA

StrokeSize
required A Long giving the stroke thickness in pixels.
ColorRGBA
required A ColorRGBA value for the stroke fill.

Events

OnChanged

Raised when the Elements array is reassigned, or when any single Border element raises its own OnChanged.

Border class

A single border stroke. Elements of Borders.Elements, and also of TextRendering.Outlines.

BlendWithBackgroundFill

When True, the border’s colour alpha-blends with the control’s BackgroundFill rather than with whatever is painted underneath the control. Lets a translucent border colour use the background tint instead of the form’s. Boolean. Default: False.

Fill

The Fill that supplies the colour or gradient used to stroke the border. Newly-constructed Border objects pre-set this to a solid black fill.

StrokeSize

The stroke thickness in pixels. PixelCount. Default: 1.

New

Constructs a Border with a default solid-black Fill.

Syntax: New CustomControlsPackage.Border

The package qualifier is required, and so is importing the reference with an asterisk — see the note at the top of this page.

OnChanged

Raised when StrokeSize, Fill, or BlendWithBackgroundFill is assigned, or when the contained Fill raises its own OnChanged.