Example #1
0
        /// <summary>
        /// 绘制文字到地图中
        /// </summary>
        /// <params name="text"></params>
        /// <params name="pPoint"></params>
        /// <params name="drawFont"></params>
        void DrawTextToMap(string text, ESRI.ArcGIS.Geometry.IPoint pPoint)
        {
            IElement element;

            ITextElement textElement = new TextElementClass();

            element = textElement as IElement;

            ITextSymbol textSymbol = new TextSymbolClass();

            textSymbol.Color = m_color;
            if (m_pFont != null)
            {
                textSymbol.Font = (stdole.IFontDisp)ESRI.ArcGIS.ADF.COMSupport.OLE.GetIFontDispFromFont(m_pFont);
                textSymbol.Size = Convert.ToDouble(m_pFont.Size);
            }
            element.Geometry = pPoint;

            textElement.Symbol = textSymbol;
            textElement.Text   = text;
            IFeature pFeature = DataEditCommon.SaveAnno(element, text);

            GIS.Common.DataEditCommon.g_pMap.SelectFeature(GIS.Common.DataEditCommon.g_pLayer, pFeature);
            GIS.Common.DataEditCommon.g_pAxMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics | esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
        }