Necesito dibujar este rectángulo en layoutview :
Intento esto pero no funciona. ¿Cómo puedo dibujar este rectángulo?
IPoint p1 = new PointClass();
p1.X = 9.9936; p1.Y = 5.8777;
IPoint p2 = new PointClass();
p2.X = p1.X; p2.Y = p1.Y + 2.62;
IPoint p3 = new PointClass();
p3.X = p1.X + 0.152 ; p3.Y = p1.Y;
IPoint p4 = new PointClass();
p4.X = p3.X; p4.Y = p3.Y + 2.62;
IPointCollection ring = new RingClass();
ring.AddPoint(p1);
ring.AddPoint(p2);
ring.AddPoint(p3);
ring.AddPoint(p4);
IRgbColor color = new RgbColorClass();
color.Red = 255; color.Blue = 28; color.Green = 20;
ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
simpleFillSymbol.Color = color;
IElement element = new PolygonElement();
element.Geometry = ring as IGeometry; // I try this.
element. ??? // I need to apply symbol on this element. but it hasn't symbol property
IMxDocument mxdoc = ArcMap.Application.Document as IMxDocument;
IPageLayout pageLayout = new PageLayout();
pageLayout = mxdoc.PageLayout;
IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;
graphicsContainer.AddElement(element, 0);
IActiveView activeView = pageLayout as IActiveView;
activeView.Refresh();
Esta solución tiene problemas en :
IElement element = new PolygonElement();
element.Geometry = ring as IGeometry;
((IFillShapeElement)element).Symbol = (IFillSymbol)simpleFillSymbol;
La solución de @Berend está funcionando..