Help! Print map elements from axPageLayoutControl

540
1
06-14-2010 02:12 AM
GPR1
by
New Contributor
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.
0 Kudos
1 Reply
EduardoCheng
New Contributor
Hello!

I'm having the same problem. Did you already unable to resolve?

thanks,
Cheng.
0 Kudos