Пример #1
0
        private void axMapControl1_OnAfterDraw(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnAfterDrawEvent e)
        {
            //If foreground refreshed
            if (e.viewDrawPhase == (int)esriViewDrawPhase.esriViewForeground)
            {
                //If a line object for splining text exists
                if (m_Polyline != null)
                {
                    //Ensure there's at least two points in the line
                    if (m_PointCollection.PointCount > 1)
                    {
                        //Create a line symbol and grab hold of the ILineSymbol interface
                        ILineSymbol lineSymbol = new SimpleLineSymbolClass();
                        //Set line symbol properties
                        lineSymbol.Color = GetRGBColor(0, 0, 0);
                        lineSymbol.Width = 2;

                        //Create a text symbol and grab hold of the ITextSymbol interface
                        ITextSymbol textSymbol = new TextSymbolClass();
                        //Create a system drawing font symbol with the specified properties
                        System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16, FontStyle.Bold);

                        //Set the text symbol font by getting the IFontDisp interface
                        textSymbol.Font  = (stdole.IFontDisp)OLE.GetIFontDispFromFont(drawFont);
                        textSymbol.Color = GetRGBColor(0, 0, 0);

                        //Create a text path and grab hold of the ITextPath interface
                        ITextPath textPath = new BezierTextPathClass();                          //to spline the text
                        //Grab hold of the ISimpleTextSymbol interface through the ITextSymbol interface
                        ISimpleTextSymbol simpleTextSymbol = (ISimpleTextSymbol)textSymbol;
                        //Set the text path of the simple text symbol
                        simpleTextSymbol.TextPath = textPath;

                        //Draw the line object and spline the user text around the line
                        object oLineSymbol = lineSymbol;
                        object oTextSymbol = textSymbol;
                        axMapControl1.DrawShape(m_Polyline, ref oLineSymbol);
                        axMapControl1.DrawText(m_Polyline, Text1.Text, ref oTextSymbol);
                    }
                }
            }
        }
Пример #2
0
 private void DrawPolygon(ESRI.ArcGIS.Geometry.IPointCollection pPointCollection, ESRI.ArcGIS.Controls.AxMapControl axMapControl)
 {
     ESRI.ArcGIS.Geometry.IPolygon pPolygon;
     pPolygon = (ESRI.ArcGIS.Geometry.IPolygon)pPointCollection;
     axMapControl.DrawShape(pPolygon);
 }