StartPoint Property (LinearGradientBrush)
Gets or sets the starting two-dimensional coordinates of the linear gradient.
<object StartPoint="Point" .../>
value = object.StartPoint
object.StartPoint = value
The starting two-dimensional coordinates for the linear gradient.
This property is read/write. The default value is a point with value 0,0.
See remarks in Point for scripting usages of this property.
A LinearGradientBrush paints an area with a linear gradient. A linear gradient defines a gradient along a line. The line's end points are defined by the StartPoint and EndPoint properties of the linear gradient. A LinearGradientBrush brush paints its GradientStops along this line.
The default linear gradient is diagonal, and the default mode for the gradient coordinate system is RelativeToBoundingBox. With these defaults, the StartPoint of a linear gradient the upper-left corner of the area being painted, 0,0. Its EndPoint is the lower-right corner of the area being painted, 1.1. The colors in the resulting gradient are interpolated and applied along vectors that parallel this diagonal axis.
The following illustration shows a diagonal gradient. A line was added to highlight the interpolation path of the gradient from the start point to the end point.
The following illustration shows the same linear gradient, but with highlighted gradient stops.
Specifying Relative or Absolute Values
Note that the BrushMappingMode property of a LinearGradientBrush determines whether its StartPoint is interpreted as a relative or absolute value. A MappingMode of RelativeToBoundingBox specifies that the StartPoint and EndPoint values are relative to the size of the painted area. A MappingMode of Absolute specifies that the StartPoint and EndPoint values are expressed in device independent pixels. By default, the MappingMode is set to RelativeToBoundingBox, making the StartPoint a relative value.