ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ColorFactory Class / BlackRGB Property
Example

In This Topic
    BlackRGB Property (ColorFactory)
    In This Topic
    Gets the black color.
    Syntax
    public CIMColor BlackRGB {get;}
    Public ReadOnly Property BlackRGB As CIMColor
    Example
    Create Lasso Line, Freehand Graphic Element
    //Must be on QueuedTask.Run(() => { ...
    
    //Build geometry
    List<Coordinate2D> plCoords = new List<Coordinate2D>();
    plCoords.Add(new Coordinate2D(1.5, 10.5));
    plCoords.Add(new Coordinate2D(1.25, 9.5));
    plCoords.Add(new Coordinate2D(1, 10.5));
    plCoords.Add(new Coordinate2D(0.75, 9.5));
    plCoords.Add(new Coordinate2D(0.5, 10.5));
    plCoords.Add(new Coordinate2D(0.5, 1));
    plCoords.Add(new Coordinate2D(0.75, 2));
    plCoords.Add(new Coordinate2D(1, 1));
    Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords);
    
    //Set symbology, create and add element to layout
    CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(
              ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid);
    //var graphic = GraphicFactory.Instance.CreateShapeGraphic(linePl, lineSym);
    
    var ge = ElementFactory.Instance.CreateGraphicElement(
                            container, linePl, lineSym, "New Freehand");
    Create Lasso Polygon, Freehand Element
    //Must be on QueuedTask.Run(() => { ...
    
    List<Coordinate2D> plyCoords = new List<Coordinate2D>();
    plyCoords.Add(new Coordinate2D(1, 1));
    plyCoords.Add(new Coordinate2D(1.25, 2));
    plyCoords.Add(new Coordinate2D(1.5, 1.1));
    plyCoords.Add(new Coordinate2D(1.75, 2));
    plyCoords.Add(new Coordinate2D(2, 1.1));
    plyCoords.Add(new Coordinate2D(2.25, 2));
    plyCoords.Add(new Coordinate2D(2.5, 1.1));
    plyCoords.Add(new Coordinate2D(2.75, 2));
    plyCoords.Add(new Coordinate2D(3, 1));
    Polygon poly = PolygonBuilderEx.CreatePolygon(plyCoords);
    
    //Set symbology, create and add element to layout
    CIMStroke outline = SymbolFactory.Instance.ConstructStroke(
                ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid);
    CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol(
             ColorFactory.Instance.RedRGB, SimpleFillStyle.ForwardDiagonal, outline);
    
    ElementFactory.Instance.CreateGraphicElement(
      container, poly, polySym, "New Lasso");
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also