ITextElement ele = new TextElementClass(); ele.Text = "大学四年生活"; IPoint point= new PointClass(){ X=e.mapX,Y=e.mapY}; (ele as IElement).Geometry =point; IFormattedTextSymbol formatted = new TextSymbolClass(); IRgbColor rgb = new RgbColorClass(); rgb.Red = 255; rgb.Green = 255; rgb.Blue = 0; ISimpleFillSymbol sfs = new SimpleFillSymbolClass(); { sfs.Color = rgb; } IBalloonCallout pCallout = new BalloonCalloutClass(); (pCallout as ITextMargins).BottomMargin =3; (pCallout as ITextMargins).LeftMargin =4; (pCallout as ITextMargins).RightMargin =4; (pCallout as ITextMargins).TopMargin =3; pCallout.Style = esriBalloonCalloutStyle.esriBCSRectangle ; pCallout.Symbol = sfs; IRgbColor rgb1 = new RgbColorClass(); rgb1.Red = 23; rgb1.Green = 34; rgb1.Blue = 254; ITextBackground back = pCallout as ITextBackground; formatted.Background = back; formatted.Color = rgb1; ele.Symbol = formatted as ITextSymbol; axMapControl1.ActiveView.GraphicsContainer.AddElement(ele as IElement, 0); axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, ele, null);
浙公网安备 33010602011771号