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;
}
}
}
}