案例一:利用PictureBox实现窗体
可以利用halcon的窗口,也可以利用C#中PictureBox实现窗体显示
using HalconDotNet;
using System.Windows.Forms;
namespace _20220822_2
{
public partial class Form1 : Form
{
private HTuple WindowID;
private HObject Image;
public Form1()
{
InitializeComponent();
Image = new HObject();
CreateHalconWindow();
LoadImage();
}
public void CreateHalconWindow()//创建一个显示窗口的方法
{
HTuple FatherWindow = this.pictureBox1.Handle;//新建一个窗口,关联到pictureBox1的句柄上
HOperatorSet.SetWindowAttr("background_color", "green");//设置窗口的背景颜色:
HOperatorSet.OpenWindow(0, 0, this.pictureBox1.Width, this.pictureBox1.Height, FatherWindow, "visible", "", out WindowID);
}
public void L