首页 > 代码库 > 创建文本TIP
创建文本TIP
public ITextElement CreateTextElement(double x, double y, string text)
{
IBalloonCallout bc = CreateBallonCallout(x, y);
IRgbColor rgb = new RgbColorClass();
{
rgb.Green = 255;
}
ITextSymbol ts = new TextSymbolClass();
{
ts.Color = rgb;
}
IFormattedTextSymbol fts = ts as IFormattedTextSymbol;
{
fts.Background = bc as ITextBackground;
}
ts.Size = 18;
IPoint point = new PointClass();
{
double width = axmap.Extent.Width / 13;
double height = axmap.Extent.Height / 20;
point.PutCoords(x + width, y + height);
}
ITextElement te = new TextElementClass();
{
te.Symbol = ts;
te.Text = text;
}
IElement e = te as IElement;
{
e.Geometry = point;
}
return te;
}