Balloons |
Balloons can be used to display rich HTML content in a Scene. Each Scene has one Balloon, accessed using the Balloon property, which can be associated with a Cartographic or screen space control position. An indicator extending from the balloon will stay fixed to that position, and the balloon will continue to display until it is hidden. The balloon will resize and position itself such that it is clear what the indicator is pointing to, and is typically used to display information about objects within a scene.
To display HTML content in a balloon, call one of the Show method overloads. The following code sample displays a balloon at a Cartographic position:
Cartographic agiHeadquarters = new Cartographic(Trig.DegreesToRadians(-75.596766667), Trig.DegreesToRadians(40.0388333333), 0.0); const string html = @"<body> <table width=""297"" height=""28"" border=""0"" style=""font-size:12""> <tr> <td width=""150""> <img src=""http://downloads.agi.com/u/images/NewBuilding.gif"" alt=""AGI Office Headquarters"" /> </td> <td width=""131""> <p> <font face=""Verdana, Geneva, sans-serif""> <strong>AGI Headquarters</strong> <br /><br /> 220 Valley Creek Blvd. <br /> Exton, PA 19341 <br /> <br /> N 40 deg 02.330 <br /> W 75 deg 35.806 </font> </p> </td> </tr> </table> </body>"; Scene.Balloon.Show(html, agiHeadquarters); Scene.Render();
You can also customize the style of the balloon. The following code sample displays a simple balloon at a control position, with a custom background color and text color:
Rectangular controlPosition = new Rectangular(100, 100); Scene.Balloon.Show("<i>Balloons</i> also support simple text and simple <b>styling.</b>", controlPosition, Color.Black, Color.White); Scene.Render();