编程语言
首页 > 编程语言> > 2021-09-23简单获取结果的源码

2021-09-23简单获取结果的源码

作者:互联网

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Cognex.VisionPro;
using Cognex.VisionPro.ToolBlock;

namespace QRhuoqu
{
    public partial class Form1 : Form
    {
        CogToolBlock Block = new CogToolBlock();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
       

{
            ConvBlock();
        }


        private void ConvBlock()
        {
            string bock = @"D:\C#\VP\9.9.1.vpp";
            Block = CogSerializer.LoadObjectFromFile(bock) as CogToolBlock;
            cogToolBlockEditV21.Subject = Block;
        }

        private void button1_Click(object sender, EventArgs e)
        {
         
                textBox1.Text = Block.Outputs[0].Value.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
            if(op.ShowDialog()==DialogResult.OK)
            {
                var filepath = op.FileName;
                Block = CogSerializer.LoadObjectFromFile(filepath) as CogToolBlock;
                cogToolBlockEditV21.Subject = Block;
            }
        }
    }
}

标签:23,void,09,System,private,源码,CogToolBlock,using,Block
来源: https://blog.csdn.net/m0_61844192/article/details/120433036