This document is archived and information here might be outdated.  Recommended version.


How to get started with the GlobeControl property pages (ArcObjects .NET 10.4 SDK)

How to get started with the GlobeControl property pages


Summary
This topic demonstrates how to get started with the GlobeControl in conjunction with the ToolbarControl, TOCControl, Control Commands, and the LicenseControl by using the property pages supplied with each control. Following the steps in this topic produces a fully functional application in only a few minutes.

In this topic


Getting started with the GlobeControl property pages

To get started with the GlobeControl property pages, follow these steps to create a new project in Visual Studio:
  1. Start Microsoft Visual Studio.
  2. From the File menu, select New, and click Project. The New Project dialog box opens.
  3. Under Project types, select either Visual Basic or Visual C# (depending on the language you're using), then select Windows Forms Application from under Templates to create a Visual Basic Windows application or a Visual C# Windows application, respectively.
  4. Name the project, click Browse and to navigate to a location to save the project, then click OK.
  5. In the Project window, click View, and click Toolbox to open the toolbox in Visual Studio.
  6. In the toolbox, click the ArcGIS Windows Forms tab to show the controls in the following illustration:

Adding controls to the form

To add controls to the form, perform the following steps:
  1. Click the GlobeControl icon in the toolbox. On the form, click and drag from one corner to the opposite corner to place the GlobeControl. Alternatively, double-click the GlobeControl icon in the toolbox to automatically place the GlobeControl on the form. Follow the same procedure to add the TOCControl, ToolbarControl, and LicenseControl icons to the form. Rearrange the control positions and resize the controls to look similar to the following:


  2. Right-click the GlobeControl and click Properties. The GlobeControl Properties dialog box opens.
  3. Click the General tab, and click the Open folder button next to the Globe Document field. See the following screen shot:


  4. The Select Globe Document dialog box opens.
  5. Navigate to a folder containing the globe document, select the globe document, and click Open.
  6. On the Properties dialog box, click Apply to link the globe document to the GlobeControl, then click OK to close the Properties dialog box.
  7. Right-click the TOCControl and click Properties. The TOCControl Properties dialog box opens.
  8. Click the General tab, select AxGlobeControl1 from the Buddy Control drop-down list, and click Apply. See the following screen shot:
  9. Click OK to close the TOCControl Properties dialog box.
  10. Right-click the ToolbarControl and click Properties. The ToolbarControl Properties dialog box opens.
  11. Click the General tab, select AxGlobeControl1 from the Buddy Control drop-down list, and click Apply.
  12. Click the Items tab on the ToolbarControl Properties dialog box and click Add. The Controls Commands dialog box opens. 
  13. Click the Toolsets tab, and either double-click the Globe toolset, or drag and drop the toolset onto the Properties dialog box with the Items tab selected. Repeat to add any other commands, toolsets, menus, or palettes, then click Close. See the following screen shot:
  14. With the Items tab still selected on the ToolbarControl Properties dialog box, click to choose an item. Drag and drop the selected item to a new position on the ToolbarControl (selection is indicated by the black outline around the item), or drag and drop an item from the ToolbarControl to remove it. Right-click an item to delete it or set its style, group, or group spacing, then click Apply. See the following screen shot:
  15. Click OK to close the ToolbarControl Properties dialog box.
  16. Load the appropriate version of ArcGIS Engine for Windows at the entry point to your application. See the following code example:
[C#]
using ESRI.ArcGIS;
...[STAThread] static void Main()
{
    if (!RuntimeManager.Bind(ProductCode.Engine))
    {
        MessageBox.Show(
            "Unable to bind to ArcGIS runtime. Application will be shut down.");
        return ;
    }

    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new MainForm());
}
[VB.NET]
Imports ESRI.ArcGIS
...

Private Sub MyApplication_Startup(ByVal sender As Object, _
                                  ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) _
                                  Handles Me.Startup
    If Not ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine) Then
        MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down.")
        e.Cancel=True 'Abort application start up
    End If
End Sub
  1. Right-click the LicenseControl and click Properties. The LicenseControl Properties dialog box opens.
  2. Click the License tab; select the ArcGIS Engine, ArcGIS for Desktop Basic, ArcGIS for Desktop Standard, and ArcGIS for Desktop Advanced check boxes under Products; and select the 3D Analyst check box under Extensions.
  3. Select the Shutdown this application if the selected licenses are not available check box, and click Apply. See the following screen shot:


  4. Click OK to close the LicenseControl Properties dialog box.
  5. To build the solution, select it from the Build menu.
  6. Click Start Debugging from the Debug menu to run the application. Toggle layer visibility by interacting with the check boxes on the TOCControl. Select a tool on the ToolbarControl and use it to interact with the GlobeControl. See the following screen shot:



See Also:

GlobeControl class




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):

Development licensing Deployment licensing
Engine Developer Kit Engine: 3D Analyst
ArcGIS for Desktop Basic: 3D Analyst
ArcGIS for Desktop Standard: 3D Analyst
ArcGIS for Desktop Advanced: 3D Analyst