AE加标注

//获得系统已安装的字体

public void GetInstalledFont()

{

            InstalledFontCollection MyFont = new InstalledFontCollection();
            FontFamily[] MyFontFamilies = MyFont.Families;
            int Count = MyFontFamilies.Length;
            for (int i = 0; i < Count; i++)
            {
                string FontName = MyFontFamilies[i].Name;                
            }

//标注图层

private void CreateLabel(ILayer pLayer)

        {
            try
            {                
                //在IGeoFeatureLayer中设置标注
                IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;
                //清除默认的标注信息
                pGeoFeatureLayer.AnnotationProperties.Clear();
                //通过它修改标注的属性
                ILabelEngineLayerProperties pLableEngine = new LabelEngineLayerProperties() as ILabelEngineLayerProperties;

                //设置标注属性
                ITextSymbol pTextSymbol = new TextSymbol();
                pTextSymbol.Color = GetRGB(255, 0, 0);
                stdole.IFontDisp myFont = new SystemFont() as stdole.IFontDisp;
                myFont.Name = ;//"Courier New";
                
                pTextSymbol.Font = myFont;
                pTextSymbol.Size =  int.Parse("8");

                //标注字段               
                string pLable = "[JCBH]";
                pLableEngine.Expression = pLable;

                pLableEngine.IsExpressionSimple = true;

                //表示是简单标注
                IBasicOverposterLayerProperties pBasic = new BasicOverposterLayerProperties();
                pBasic.NumLabelsOption = esriBasicNumLabelsOption.esriOneLabelPerShape;

                pLableEngine.BasicOverposterLayerProperties = pBasic;
                pLableEngine.Symbol = pTextSymbol;

                //标注接口
                IAnnotateLayerProperties pAnLayerProp = pLableEngine as IAnnotateLayerProperties;

                pGeoFeatureLayer.AnnotationProperties.Add(pAnLayerProp);
                //显示标注

                pGeoFeatureLayer.DisplayAnnotation = true;

                //刷新
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值