Version

CreateRectangularGradientFill(Double,Double,Double,Double,WorkbookColorInfo,WorkbookColorInfo) Method

Creates a rectangular gradient that can be applied to a cell's fill.
Syntax
'Declaration
 
Public Overloads Shared Function CreateRectangularGradientFill( _
   ByVal left As Double, _
   ByVal top As Double, _
   ByVal right As Double, _
   ByVal bottom As Double, _
   ByVal colorInfo1 As WorkbookColorInfo, _
   ByVal colorInfo2 As WorkbookColorInfo _
) As CellFillRectangularGradient
public static CellFillRectangularGradient CreateRectangularGradientFill( 
   double left,
   double top,
   double right,
   double bottom,
   WorkbookColorInfo colorInfo1,
   WorkbookColorInfo colorInfo2
)

Parameters

left
The left edge of the inner rectangle of the gradient, ranging from 0.0 (the left of the cell) to 1.0 (the right of the cell).
top
The top edge of the inner rectangle of the gradient, ranging from 0.0 (the top of the cell) to 1.0 (the bottom of the cell).
right
The right edge of the inner rectangle of the gradient, ranging from 0.0 (the left of the cell) to 1.0 (the right of the cell).
bottom
The bottom edge of the inner rectangle of the gradient, ranging from 0.0 (the top of the cell) to 1.0 (the bottom of the cell).
colorInfo1
A WorkbookColorInfo which describes the color at the inner rectangle of the gradient.
colorInfo2
A WorkbookColorInfo which describes the color at the outer rectangle (cell edges) of the gradient.
Exceptions
ExceptionDescription
System.ArgumentExceptioncolorInfo1 or colorInfo2 is an automatic or a system color.
System.ArgumentOutOfRangeExceptionleft, top, right, or bottom are less than 0.0 or greater than 1.0.
Remarks

The rectangular gradient is defined by specifying an inner rectangle and a set of gradient stops. The gradient goes from the edges of the inner rectangle to the edges of the cell. If the inner rectangle does not have a height or width of 0, the color of the first gradient stop will be filled in the center of the inner rectangle.

The inner rectangle is defined by the left, top, right, and bottom parameters. They are relative values ranging from 0.0 to 1.0 and they go from the top/left to the bottom/right. So, for example, to specify a gradient that goes out from the center, all values would be 0.5. Or to specify a gradient which goes out from the bottom-left corner of the cell, the following values would be used: left = 0.0, top = 1.0, right = 0.0, bottom = 1.0.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also