Dim vppFile As String = Application.StartupPath + "\test.vpp" Dim myToolGroup As CogToolGroup = CType(CogSerializer.LoadObjectFromFile(vppFile),CogToolGroup) Dim myToolBlock As CogToolBlock = myToolGroup.Tools.Item("CogToolBlock1") 'Dim myAcqFifoTool As CogAcqFifoTool = myToolGroup.Tools.Item("CogAcqFifoTool1")' 没有相机 Dim myImageFileTool As CogImageFileTool = myToolGroup.Tools.Item("CogImageFileTool1") ' 使用图片工具 'myAcqFifoTool.Run() ' 相机 myImageFileTool.Run() ' 图片 myToolBlock.Run() ' 显示 图片+结果 'CogRecordDisplay1.Image = myAcqFifoTool.OutputImage ' 相机 CogRecordDisplay1.Image = myImageFileTool.OutputImage ' 图片 CogRecordDisplay1.Record = myToolBlock.CreateLastRunRecord CogRecordDisplay1.Fit() '''''''''''''''''''''''''''''''' 保存控件当前实际显示结果 '''''''''''''''''''''''''''''''''''' CogRecordDisplay1.CreateContentBitmap(Display.CogDisplayContentBitmapConstants.Display).Save("test.png") ' 输出结果值 Debug.WriteLine(">>>> X value : " + myToolBlock.Outputs.Item("Output_X").Value.ToString) Debug.WriteLine(">>>> Y value : " + myToolBlock.Outputs.Item("Output_Y").Value.ToString)注意保存的是控件内的显示效果,包含蓝色背景,如果有检测结果,也会一并保存