motogp

Help! Print map elements from axPageLayoutControl

Discussion created by motogp on Jun 14, 2010
Latest reply on Oct 18, 2010 by eduardocheng
I have a map on axPageLayoutControl1 with Line on it (I use standard example from c:\Program Files\ArcGIS\DeveloperKit\SamplesNET\Engine\PageLayoutControlPrintPreview\  ), but when I try print, only the map is printed without the elements (Line). How can I print the elements as well?


This code is my draw line cod:

private void axPageLayoutControl1_OnAfterDraw(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnAfterDrawEvent e)
        {
            if (e.viewDrawPhase == (int)esriViewDrawPhase.esriViewForeground)
            {
                IActiveView activeViewForLine = (IActiveView)axPageLayoutControl1.ActiveView;
                ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeViewForLine.ScreenDisplay;

                ISimpleLineSymbol LineSymbol = new SimpleLineSymbolClass();
                LineSymbol.Width = 30;

                IPoint pt1 = new PointClass();
                IPoint pt2 = new PointClass();
                pt1.X = 0;
                pt1.Y = 17;
                pt2.X = 30;
                pt2.Y = 0;

                object Missing = Type.Missing;
                IGeometry fill = new PolylineClass();
                ((IPointCollection)fill).AddPoint(pt1, ref Missing, ref Missing);
                ((IPointCollection)fill).AddPoint(pt2, ref Missing, ref Missing);

                screenDisplay.SetSymbol((ISymbol)LineSymbol);
                screenDisplay.DrawPolyline(fill);
            }
        }

Preview result:


Thanks.

Attachments

Outcomes