Parameters
- color
- ArcGIS.Core.CIM.CIMColor
- width
- The width of stroke to construct.
- lineStyle
- SimpleLineStyle
//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"); });
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Solid); CIMPolygonSymbol fillWithOutline = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Solid, outline);
Target Platforms: Windows 11, Windows 10, Windows 8.1