VisionPro工具分组(因为Vs2019导入VisionPro是全导入,为了方便,可以自建项进行分类)
各选择项
1 VisionPro Tool Edit Controls
2 VisionPro Display Controls
3 VisionPro Shape Edit Controls
4 VisionPro System Controls
各选择项下的组件
VisionPro Display Controls:
CogRecordDisplay
操作步骤
C:\Program Files (x86)\Cognex\VisionPro\ReferencedAssemblies
会有很多警告窗口,不用管,一路确定,因为有一些dll,不是控件,是不能加进工具箱的
实例
1 using Cognex.VisionPro;
2 using Cognex.VisionPro.ImageFile;
3 using System;
4 using System.Collections.Generic;
5 using System.ComponentModel;
6 using System.Data;
7 using System.Drawing;
8 using System.IO;
9 using System.Linq;
10 using System.Text;
11 using System.Threading.Tasks;
12 using System.Windows.Forms;
13
14 namespace WindowsFormsApp20000
15 {
16 public partial class Form1 : Form
17 {
18 private CogImageFileTool m_ImageFileTool;
19
20 public Form1()
21 {
22 InitializeComponent();
23
24 m_ImageFileTool = new CogImageFileTool();
25
26 }
27
28 private void DisplayImage(object sender, EventArgs e)
29 {
30 m_ImageFileTool.Operator.Open(Directory.GetCurrentDirectory() + "/Barcode.bmp", CogImageFileModeConstants.Read);
31
32 m_ImageFileTool.Run();
33
34 cogRecordDisplay1.Image = m_ImageFileTool.OutputImage as CogImage8Grey;
35
36 cogRecordDisplay1.Fit(true);
37 }
38 }
39 }