ArcObjects Library Reference  (Display)    

GradientPattern CoClass

A gradient fill pattern object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


GradientPattern is used to draw a BasicFillSymbol using a color ramp.

Extended Error Information

Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.


Interfaces Description
IDocumentVersionSupportGEN (esriSystem) Provides access to extend the IObjectStream interface with methods to hande saving objects that did not exist in previous versions of the software.
IDrawingOutline Provides access to methods dealing with the outline of a drawing rule.
IFillPattern Provides access to methods that control the fill pattern.
IGraphicAttributes Provides access to members that control the graphic attributes.
IGraphicAttributes2 Provides access to members that control the graphic attributes.
IPersist Defines the single method GetClassID, which is designed to supply the CLSID of an object that can be stored persistently in the system. IPersist is the base interface for three other interfaces: IPersistStorage, IPersistStream, and IPersistFile.
IPersistStream (esriSystem)
ISupportErrorInfo Indicates whether a specific interface can return Automation error objects.


GradientPattern is used to draw BasicFillSymbol with a gradient fill pattern.

Use IFillPattern interface to create a new GradientPattern and IGraphicAttributes interface to assign attribute values to the fill pattern.

This object can be controlled using the following GraphicAttributes:

The following example shows how to assign values to the attributes of a GradientPattern using IGraphicAttributes interface.

[Visual Basic 6.0]
    Dim pBS As IBasicSymbol
    Dim pBFillSym As IBasicFillSymbol
    Dim pFillPattern As IFillPattern
    Dim pGA As IGraphicAttributes
    Dim myColor As IColor
    Dim pColorRampAlgorithm As esriColorRampAlgorithm
    Dim pGradientFillStyle  As esriGradientFillStyle
    Dim pGradPattern As IFillPattern
    Dim pGAPattern As IGraphicAttributes
    Set pBS = pRule.Layer(0) 'Bottom Layer which draws first
    If TypeOf pBS Is IBasicFillSymbol Then
        Set pBFillSym = pBS  
        Set pGradPattern = New GradientPattern
        Set pGAPattern = pGradPattern
        Set myColor = New RgbColor
        myColor.RGB = RGB(255, 255, 155)
        pGAPattern.Value(0) = myColor  'change color1
        Set myColor = New RgbColor
        myColor.RGB = RGB(155, 255, 155)
        pGAPattern.Value(1) = myColor  'change color2
        pGradientFillStyle = esriGFSRectangular
        pGAPattern.Value(2) = pGradientFillStyle   'change style
        pGAPattern.Value(3) = 45    'change interval
        pGAPattern.Value(4) = 60.5   'change percentage
        pColorRampAlgorithm = esriLabLChAlgorithm
        pGAPattern.Value(5) = pColorRampAlgorithm  'change algorithm
        pGAPattern.Value(6) = 45.5   'change angle
        Set pBFillSym.FillPattern = pGradPattern
    End If