ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / SymbolFactory Class / ConstructStroke Method / ConstructStroke(CIMColor,Double,SimpleLineStyle) Method
ArcGIS.Core.CIM.CIMColor
The width of stroke to construct.
SimpleLineStyle
Example

In This Topic
    ConstructStroke(CIMColor,Double,SimpleLineStyle) Method
    In This Topic
    Constructs a stroke of specific color, width and style.
    Syntax
    Public Overloads Function ConstructStroke( _
       ByVal color As CIMColor, _
       ByVal width As Double, _
       ByVal lineStyle As SimpleLineStyle _
    ) As CIMStroke

    Parameters

    color
    ArcGIS.Core.CIM.CIMColor
    width
    The width of stroke to construct.
    lineStyle
    SimpleLineStyle

    Return Value

    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);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also