创建AE气泡提示

public IBalloonCallout createBalloonCallout(double x, double y)
{
IRgbColor rgb = new RgbColorClass();
{
rgb.Red = 255;
rgb.Green = 255;
rgb.Blue = 200;

}
ISimpleFillSymbol sfs = new SimpleFillSymbolClass();
{
sfs.Color = rgb;
sfs.Style = esriSimpleFillStyle.esriSFSSolid;
}

IPoint p = new PointClass();
{
p.PutCoords(x, y);
}

IBalloonCallout bc = new BalloonCalloutClass();
{
bc.Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle;
//
bc.Symbol = sfs;
//
bc.LeaderTolerance = 20;
//1

bc.AnchorPoint = p;
}

return bc;
}


public ITextElement createTextElement(double x, double y, string text)
{
IBalloonCallout bc = createBalloonCallout(x, y);

IRgbColor rgb = new RgbColorClass();
{
rgb.Red = 255;
rgb.Green = 55;
rgb.Blue = 200;
}
ITextSymbol ts = new TextSymbolClass();
{
ts.Color = rgb;
}

IFormattedTextSymbol fts = ts as IFormattedTextSymbol;
{
fts.Background = bc as ITextBackground;
}
//fts.Size = 8;
ts.Size = 12;
ts.RightToLeft = false;
ts.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;

IPoint point = new PointClass();
{
double width = axMapControl1.Extent.Width / 15;
double height = axMapControl1.Extent.Height / 5;
point.PutCoords(x + width, y + height);
}

// ESRI .ArcGIS .Carto .ITEXT
ITextElement te = new TextElementClass();
//IMarkerElement me = new MarkerElementClass();
{
te.Symbol = ts;
//ts.Text = text;
te.Text = text;

// te.Symbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHAFull ;
te.Symbol.VerticalAlignment = esriTextVerticalAlignment.esriTVATop;
}

IElement e = te as IElement;
{
e.Geometry = point;
}
return te;

}

posted on 2012-05-16 09:31  pennygiser  阅读(287)  评论(0编辑  收藏  举报