Adding a Display Toolbar and Status BarCognex VisionPro

A Cognex Display toolbar allows you to manipulate the image within a Cognex Display control, while a Cognex Display status bar displays information about that image. See the topic Displaying An Image for details on showing the images you acquire with your Visual Studio.NET application. The following figure shows a Cognex Display control along with a toolbar and status bar:

Display Images Walkthrough Add Toolbar Add Display Toolbars splash

To add a toolbar and status bar to your Visual Studio.NET application, perform the following steps:

  1. Choose Project->Add References and add a reference to the assembly Cognex.VisionPro.Controls, which contains the objects and instances of the toolbar and status bar.
  2. Add a Display control to your Windows form as described in the topic Displaying An Image. The following figure shows a Windows form with a Cognex Display control:

    Display Images Walkthrough Add Toolbar Form With Display

  3. Switch to the VisionPro System Controls tab of the Visual Studio.NET toolbox and select CogDisplayToolbarV2, which is shown in the following figure:

    Display Images Walkthrough Add Toolbar Icon Display Toolbar

  4. Add the CogDisplayToolbarV2 control to your Windows form, as shown in the following figure:

    Display Images Walkthrough Add Toolbar Form With Tool Bar

    The following figure describes the function of each buttons:

    Display Images Walkthrough Add Toolbar Add Display Toolbars toolbar

  5. (Optional) You may choose to dock the toolbar to the top of the Windows form, as shown in the following figure:

    Display Images Walkthrough Add Toolbar Docked Tool Bar

    Note: If your form uses ToolStrips instead of a toolbar, or if you want to add the controls to an existing toolbar, use the CogDisplayToolStrip instead of the toolbar control:

    Display Images Walkthrough Add Toolbar Icon Display Tool Strip

  6. Connect the toolbar to the Cognex Display control, as shown in the following C# example, where the toolbar variable is cogDisplayToolbarV21 and the Display control variable is cogDisplay1.

    cogDisplayToolbarV21.Display = cogDisplay1;
  7. Select CogDisplayStatusBarV2 from the Visual Studio.NET toolbox, as shown in the following figure:

    Display Images Walkthrough Add Toolbar Icon Display Status Bar

  8. Add the CogDisplayStatusBarV2to your Windows form, as shown in the following figure:

    Display Images Walkthrough Add Toolbar Form With Both

    The following figure describes the various parts of the status bar:

    Display Images Walkthrough Add Toolbar Add Display Toolbars status bar

  9. (Optional) You may choose to dock the status bar to the bottom of the Windows form, as shown in the following figure:

    Display Images Walkthrough Add Toolbar Docked Status Bar

  10. Connect the status bar to the Cognex Display control, as shown in the following C# example, where the status bar variable is cogDisplayStatusBarV21 and the Display control variable is cogDisplay1.

    cogDisplayStatusBarV21.Display = cogDisplay1;

The toolbar and status bar will now work with the CogDisplay control.