ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SymbolFactory Class / ConstructPolygonSymbol Method / ConstructPolygonSymbol(CIMColor,SimpleStipplePattern,CIMColor) Method
Example

In This Topic
    ConstructPolygonSymbol(CIMColor,SimpleStipplePattern,CIMColor) Method
    In This Topic
    Constructs a polygon symbol of specific color, fill color, and stipple pattern. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Function ConstructPolygonSymbol( _
       ByVal color As CIMColor, _
       ByVal stipplePattern As SimpleStipplePattern, _
       ByVal fillColor As CIMColor _
    ) As CIMPolygonSymbol

    Parameters

    color
    stipplePattern
    fillColor

    Return Value

    Exceptions
    ExceptionDescription
    Value cannot be null: color
    This method must be called within the lambda passed to QueuedTask.Run
    Remarks
    The polygon symbol outline and stipple color are specified with "color". The underlying fill color is specified via "fillColor". Fill color can be null to create a hollow background fill. To create a stipple fill with no outline, use ConstructPolygonSymbol(CIMFill,CIMStroke,CIMColor,SimpleStipplePattern). Note: the stipple pattern is generated with a marker not a fill.
    Example
    Create rectangle graphic with simple symbology
    {
      //Create a simple 2D rectangle graphic and apply simple fill and
      //outline symbols.
    
      //Note: Must be on QueuedTask.Run
    
      //Build 2D envelope geometry
      Coordinate2D rec_ll = new Coordinate2D(1.0, 4.75);
      Coordinate2D rec_ur = new Coordinate2D(3.0, 5.75);
    
      Envelope rec_env = EnvelopeBuilderEx.CreateEnvelope(rec_ll, rec_ur);
    
      //Set symbology, create and add element to layout
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
        ColorFactory.Instance.BlackRGB, 5.0, SimpleLineStyle.Solid);
      CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol(
        ColorFactory.Instance.GreenRGB, SimpleFillStyle.DiagonalCross, outline);
    
    
      GraphicElement recElm = ElementFactory.Instance.CreateGraphicElement(
        layout, rec_env, polySym, "New Rectangle");
      //Or use Predefined shape
      GraphicElement recElm2 = ElementFactory.Instance.CreatePredefinedShapeGraphicElement(
                                layout, PredefinedShape.Rectangle, rec_env, polySym,
                                "New Rectangle2");
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.1 or higher.
    See Also