Add an Application Manifest

Perform the following steps to add an application manifest to the project that has a dependency on Cognex.VisionPro.Displays.Controls.css

  1. Right-click on the project, Add -> New Item -> Application Manifest File (Windows Only).

  2. Add the following statements inside the <assembly> tag:

    Copy
    <dependency>
        <dependentAssembly>
            <assemblyIdentity
                name="Cognex.Vision.Display.Controls.sxs"
                version="71.0.0.0"
                processorArchitecture="ia64"
                type="win32" />
        </dependentAssembly>
    </dependency>
  3. Copy the file DotNetApp.exe.manifest from C:\Program Files\Cognex\VisionPro10.0\manifest to the directory where your application is located.
  4. Right-click on the project in Visual Studio, select Properties, and disable creating a manifest for the application by changing the following setting: 

  5. Build and compile the solution.

    You must build the solution or the edit controls will not appear in the Form Designer's ToolBox.

  6. Add a ToolBlock Edit control.

    1. Open up the Form Designer (Right-Click on the Form1.cs -> View Designer)

    2. Open the Visual Studio Toolbox window (View -> Toolbox).

    3. Drag and drop the ToolBlock edit control onto your form.

  7. Initialize VisionPro code:

    1. Add calls to Initialize() and Shutdown() in your the following In the Program.cs's static void Main(): 

      Copy
      [STAThread]
      static void Main()
      {
          Cognex.Vision.Startup.Initialize();
          ...
          ...
          Cognex.Vision.Startup.Shutdown(); 
      }
  8. Run your application.
  9. (Optional) Create a basic Blob tool test: 

    Add the following code below the InitializeComponent(); call in Form1.cs:

    Copy
    var imageFileTool = new ImageFileTool();
    // Update the location of the image to use to fit your set up
    imageFileTool.Operator.Open("Images\\blobs.bmp", ImageFileModeConstants.Read);
    var blobTool = new BlobTool();
    toolBlockEdit1.Subject.Tools.Add(imageFileTool);
    toolBlockEdit1.Subject.Tools.Add(blobTool);
    toolBlockEdit1.Subject.AddLink(imageFileTool.Outputs[0], blobTool.Inputs[0]);
    toolBlockEdit1.Subject.Run();