//获得系统已安装的字体
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);
}
}
4896

被折叠的 条评论
为什么被折叠?



