RadialGradientBrush.GradientStops()

From Xojo Documentation

Property (As Pair )
aRadialGradientBrush.GradientStops() = newPairValue
or
PairValue = aRadialGradientBrush.GradientStops()

Supported for all project types and targets.

An array of values indicating the locations where the gradient changes color.

Notes

Each element of the array is a Pair where the left value is a position and the right, a Color. The position is the percentage of the area to be drawn with the Color passed.

Example Code

This example (in the Paint event of a Canvas control) draws an oval with a gradient. The GradientStops property is used to add gradients at 0%, 50%, and 80%. In this example, red will be used from 0% to 50% of the drawing area:

Var radialBrush As New RadialGradientBrush
radialBrush.StartPoint = New Point(g.width/2, g.height/2)
radialBrush.EndPoint = radialBrush.StartPoint
radialBrush.GradientStops.Add(New Pair(0, Color.Red))
radialBrush.GradientStops.Add(New Pair(0.5, Color.Blue))
radialBrush.GradientStops.Add(New Pair(0.8, Color.Green))
radialBrush.StartRadius = 0
radialBrush.EndRadius = 500
g.Brush = radialBrush
g.FillOval(0, 0, g.Width, g.Height)