1. Create a font
<summary>
Font settings
</summary>
<param name= "Size" >the size.</param>
<param name= "FontName" >the fontname.</param>
<returns>
IFontDisp
</returns>
public static stdole. IFontDisp Getifontdisp (float size, string fontname)
{
string fontfamilyname = FontName;
FontStyle fontstyle = fontstyle.regular;
Font font = new Font (fontfamilyname, size, fontstyle);
Return OLE. Getifontdispfromfont (font) as stdole. IFontDisp;
}
2. Create a text annotation style
<summary>
Text annotation Style
</summary>
<param name= "Geometry" > Callout point, one point </param>
<param name= "text" > Label content </param>
<returns>
IElement
</returns>
public static Itextsymbol gettextelement (igeometry geometry, string text)
{
Itextsymbol Textsymbol = new Textsymbolclass ();
Textsymbol.color = colorcustom (0, 0, 0);
you can not directly modify The properties such as TextSymbol.Font.Bold, invalid
Stdole. IFontDisp font = GETIFONTDISP (9F, " Arial ");
Font. Bold = false;
Font. Italic = false;
Font. Strikethrough = false;
Font. underline = false;
Textsymbol.font = Font;
Textsymbol.horizontalalignment = Esritexthorizontalalignment.esrithaleft; level
Textsymbol.verticalalignment = Esritextverticalalignment.esritvatop;; Vertical
return textsymbol;
}
3. Create a text annotation
Itextelement textelement = new Textelementclass ();
Textelement.scaletext = true;
Textelement.symbol = Gettextelement ();
Textelement.text = Text;
ielement element = TextElement as ielement;
Element. Geometry = Geometry;
Create a text annotation textelement