I need to draw this rectangle on layoutview :
I try this but it doesn't work. How can I draw this rectangle ?
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); IElement element = new PolygonElement(); element.Geometry = ring as IGeometry; IRgbColor color = new RgbColorClass(); color.Red = 168; color.Green = 170; color.Blue = 171; ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSVertical; 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();
أكثر...

I try this but it doesn't work. How can I draw this rectangle ?
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); IElement element = new PolygonElement(); element.Geometry = ring as IGeometry; IRgbColor color = new RgbColorClass(); color.Red = 168; color.Green = 170; color.Blue = 171; ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass(); simpleFillSymbol.Color = color; simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSVertical; 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();
أكثر...