1 private string path = AppDomain.CurrentDomain.BaseDirectory + "12.vpp"; 2 private string path1 = AppDomain.CurrentDomain.BaseDirectory + "CCD.vpp"; 3 private string path2 = AppDomain.CurrentDomain.BaseDirectory + "Tool.vpp"; 4 private CogToolBlock tb; 5 private CogToolBlock tb1; 6 private CogAcqFifoTool acq; 7 private CogAcqFifoTool acq1; 8 public Form1() 9 { 10 InitializeComponent(); 11 //序列化CogFifoTool 工具 12 tb = CogSerializer.LoadObjectFromFile(path) as CogToolBlock; 13 //加载到CogToolBlockEdit控件中 14 cogToolBlockEditV21.Subject = tb; 15 // 转换成取像 16 acq = tb.Tools[0] as CogAcqFifoTool; 17 } 18 19 private void button1_Click(object sender, EventArgs e) 20 { 21 acq.Run(); 22 cogRecordDisplay1.Image = acq.OutputImage; 23 cogRecordDisplay1.Fit(); 24 } 25 26 private void button2_Click(object sender, EventArgs e) 27 { 28 //初始化相机工具 29 acq1 = CogSerializer.LoadObjectFromFile(path1) as CogAcqFifoTool; 30 acq1.Run(); 31 cogRecordDisplay1.Image = acq1.OutputImage; 32 cogRecordDisplay1.Fit(); 33 } 34 35 private void btnLive_Click(object sender, EventArgs e) 36 { 37 //相机实时状态 38 if (cogRecordDisplay1.LiveDisplayRunning) 39 { 40 41 cogRecordDisplay1.StopLiveDisplay(); 42 btnLive.BackColor = Color.Gray; 43 } 44 else 45 { 46 cogRecordDisplay1.StartLiveDisplay(acq.Operator, true); 47 btnLive.BackColor = Color.Green; 48 } 49 // cogRecordDisplay1.StartLiveDisplay(acq.Operator); 50 } 51 52 private void btnStop_Click(object sender, EventArgs e) 53 { 54 //关闭实时状态 55 cogRecordDisplay1.StopLiveDisplay(); 56 } 57 58 private void button3_Click(object sender, EventArgs e) 59 { 60 acq.Run(); 61 tb1.Inputs["InputImage"].Value = acq.OutputImage; 62 tb1.Run(); 63 cogRecordDisplay1.Record = tb1.CreateLastRunRecord().SubRecords[1]; 64 65 //显示运行记录 66 //cogRecordDisplay1.Image = acq.OutputImage; 67 //cogRecordDisplay1.Record = tb1.CreateLastRunRecord(); 68 } 69 70 private void Form1_Load(object sender, EventArgs e) 71 { 72 tb1 = CogSerializer.LoadObjectFromFile(path2) as CogToolBlock; 73 cogToolBlockEditV22.Subject = tb1; 74 } 75 }