ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SymbolFactory Class / ConstructPolygonSymbol Method / ConstructPolygonSymbol(CIMColor,SimpleFillStyle,CIMStroke) Method
ArcGIS.Core.CIM.CIMColor
SimpleFillStyle
ArcGIS.Core.CIM.CIMStroke
Example

In This Topic
    ConstructPolygonSymbol(CIMColor,SimpleFillStyle,CIMStroke) Method
    In This Topic
    Constructs a polygon symbol of specific color, style and outline.
    Syntax
    Public Overloads Function ConstructPolygonSymbol( _
       ByVal color As CIMColor, _
       ByVal fillStyle As SimpleFillStyle, _
       ByVal outline As CIMStroke _
    ) As CIMPolygonSymbol

    Parameters

    color
    ArcGIS.Core.CIM.CIMColor
    fillStyle
    SimpleFillStyle
    outline
    ArcGIS.Core.CIM.CIMStroke

    Return Value

    Remarks
    Passing null for outline will create a polygon symbol without an outline.
    Example
    Create rectangle graphic with simple symbology
    //Create a simple 2D rectangle graphic and apply simple fill and
    //outline symbols.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build 2D envelope geometry
      Coordinate2D rec_ll = new Coordinate2D(1.0, 4.75);
      Coordinate2D rec_ur = new Coordinate2D(3.0, 5.75);
      //At 2.x - Envelope rec_env = EnvelopeBuilder.CreateEnvelope(rec_ll, rec_ur);
      Envelope rec_env = EnvelopeBuilderEx.CreateEnvelope(rec_ll, rec_ur);
    
      //Set symbolology, 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);
    
      //At 2.x - GraphicElement recElm =
      //           LayoutElementFactory.Instance.CreateRectangleGraphicElement(
      //                                                  layout, rec_env, polySym);
      //         recElm.SetName("New Rectangle");
      //
      GraphicElement recElm = ElementFactory.Instance.CreateGraphicElement(
        container, rec_env, polySym, "New Rectangle");
      //Or use Predefined shape
      GraphicElement recElm2 = ElementFactory.Instance.CreatePredefinedShapeGraphicElement(
                                container, PredefinedShape.Rectangle, rec_env, polySym, 
                                "New Rectangle2");
    });
    How to construct a polygon symbol of specific color, fill style and outline
    CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Solid);
    CIMPolygonSymbol fillWithOutline = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Solid, outline);
    
    How to construct a polygon symbol without an outline
    CIMPolygonSymbol fillWithoutOutline = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Solid, null);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also