Prompt box for creating bubbles in AE (VB. NET and C # source code)

Source: Internet
Author: User
Tags ipoint
The following method creates a bubble prompt box with AE:

1. VB. NET source code

''' <Summary>
''' Create a text prompt box
''' </Summary>
''' <Param name = "X"> the X coordinate of the position marked by the prompt box </param>
''' <Param name = "Y"> Y coordinate of the position marked by the prompt box </param>
''' <Param name = "ptextstring"> text displayed in the prompt box </param>
''' <Param name = "Ppoint"> point pointed by the arrow in the prompt box </param>
''' <Param name = "pgraphicscontainer"> graphicscontainer containing the prompt box </param>
''' <Returns> </returns>
''' <Remarks> </remarks>
Public Function createtextelement (byval X as double, byval y as double, byval ptextstring as string, optional byval Ppoint as ipoint = nothing, optional byval pgraphicscontainer as igraphicscontainer = nothing) as ielement
Dim pelement as ielement = new markerelementclass ()
Dim ptelement as ielement = new textelementclass ()
Dim ptextsymbol as iformattedtextsymbol = new textsymbolclass ()
Dim pballooncallout as iballooncallout = createballooncallout (x, y)
Dim pcolor as irgbcolor = new rgbcolorclass ()
Pcolor. red= 150
Pcolor. Green = 0
Pcolor. Blue = 0
Ptextsymbol. Color = pcolor
Dim ptextbackground as itextbackground
Ptextbackground = pballooncallout
Ptextsymbol. Background = ptextbackground
Ptextsymbol. size = 8
Ctype (ptelement, itextelement). symbol = ptextsymbol
Ctype (ptelement, itextelement). Text = ptextstring
If Ppoint is nothing then Ppoint = new point: Ppoint. putcoords (x + const_dis, Y + const_dis)
Ptelement. Geometry = Ppoint
Pgraphicscontainer. addelement (ptelement, 1)
Return ptelement
End Function

''' <Summary>
''' Create a balloon prompt box
''' </Summary>
''' <Param name = "X"> X coordinate of the position of the prompt box </param>
''' <Param name = "Y"> Y coordinate of the prompt box </param>
''' <Returns> </returns>
''' <Remarks> </remarks>
Public Function createballooncallout (byval X as double, byval y as double) as iballooncallout
Dim prgbclr as irgbcolor = new rgbcolorclass ()
Prgbclr. red= 255
Prgbclr. Blue = 255
Prgbclr. green= 255
Dim psmplfill as isimplefillsymbol = new simplefillsymbolclass ()
Psmplfill. Color = prgbclr
Psmplfill. Style = esrisimplefillstyle. esrisfssolid
Dim pbllncallout as iballooncallout = new ballooncalloutclass ()
Pbllncallout. Style = esriballooncalloutstyle. esribcsroundedrectangle
Pbllncallout. symbol = psmplfill
Pbllncallout. leadertolerance = 1
Dim Ppoint as ipoint = new ESRI. ArcGIS. Geometry. pointclass ()
Ppoint. x = x
Ppoint. Y = y
Pbllncallout. anchorpoint = Ppoint
Return pbllncallout
End Function

2. C # source code
 
Public void createtextelment (Double X, Double Y)
{
Ipoint Ppoint = new pointclass ();
IMAP pmap = axmapcontrol1.map;
Iactiveview pactiveview = pmap as iactiveview;
Igraphicscontainer pgraphicscontainer;
Ielement pelement = new markerelementclass ();
Ielement ptelement = new textelementclass ();
Pgraphicscontainer = (igraphicscontainer) pactiveview;
Iformattedtextsymbol ptextsymbol = new textsymbolclass ();
Iballooncallout pballooncallout = createballooncallout (x, y );
Irgbcolor pcolor = new rgbcolorclass ();
Pcolor. red= 150;
Pcolor. Green = 0;
Pcolor. Blue = 0;
Ptextsymbol. Color = pcolor;
Itextbackground ptextbackground;
Ptextbackground = (itextbackground) pballooncallout;
Ptextsymbol. Background = ptextbackground;
(Itextelement) ptelement). symbol = ptextsymbol;
(Itextelement) ptelement). Text = "test ";
Ppoint. x = x + 42;
Ppoint. Y = Y + 42;
Ptelement. Geometry = Ppoint;
Pgraphicscontainer. addelement (ptelement, 1 );
Pactiveview. partialrefresh (esriviewdrawphase. esriviewgraphics, null, null );
}

Public iballooncallout createballooncallout (Double X, Double Y)
{
Irgbcolor prgbclr = new rgbcolorclass ();
Prgbclr. red= 255;
Prgbclr. Blue = 255;
Prgbclr. green= 255;
Isimplefillsymbol psmplfill = new simplefillsymbolclass ();
Psmplfill. Color = prgbclr;
Psmplfill. Style = esrisimplefillstyle. esrisfssolid;
Iballooncallout pbllncallout = new ballooncalloutclass ();
Pbllncallout. Style = esriballooncalloutstyle. esribcsrectangle;
Pbllncallout. symbol = psmplfill;
Pbllncallout. leadertolerance = 1;
Ipoint Ppoint = new ESRI. ArcGIS. Geometry. pointclass ();
Ppoint. x = X;
Ppoint. Y = y;
Pbllncallout. anchorpoint = Ppoint;
Return pbllncallout;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.