How to get started with the SceneControl property pages


Summary This topic demonstrates how to get started with the SceneControl 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 SceneControl property pages

To get started with the SceneControl property pages, follow these steps to create a project in Visual Studio:
  1. Open Microsoft Visual Studio.
  2. From the File menu, select New, and click Project. The New Project dialog box opens.
  3. Select either Visual Basic or Visual C# under Project types, 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 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 SceneControl icon in the toolbox. On the form, click and drag from one corner to the opposite corner to place the SceneControl. Alternatively, double-click the SceneControl icon in the toolbox to automatically place the SceneControl 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 SceneControl and click Properties. The SceneControl Properties dialog box opens.
  3. Click the General tab, and click the Open folder button next to the Scene Document field. See the following screen shot:



    The Select Scene Document dialog box opens.
  4. Navigate to a folder containing the scene document, select the scene document, and click Open.
  5. On the Properties dialog box, click Apply to link the scene document to the SceneControl, then click OK to close the Properties dialog box.
  6. Right-click the TOCControl and click Properties. The TOCControl Properties dialog box opens.
  7. Click the General tab, select AxSceneControl1 from the Buddy Control drop-down list, and click Apply. See the following screen shot:

  8. Click OK to close the TOCControl Properties dialog box.
  9. Right-click the ToolbarControl and click Properties. The ToolbarControl Properties dialog box opens.
  10. Click the General tab, select AxSceneControl1 from the Buddy Control drop-down list, and click Apply.
  11. Click the Items tab on the Properties dialog box and click Add. The Control Commands dialog box opens.
  12. Click the Toolsets tab, and either double-click the Scene 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:

  13. 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:

  14. Click OK to close the ToolbarControl Properties dialog box.
  15. Load ArcGIS Engine runtime 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, ArcView, ArcEditor, and ArcInfo 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 SceneControl. See the following screen shot:



See Also:

SceneControl 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 Runtime: 3D
ArcView: 3D Analyst
ArcEditor: 3D Analyst
ArcInfo: 3D Analyst