using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HalconDotNet;
namespace exercise01
{
public partial class Form1 : Form
{
public Form1(){
InitializeComponent();}
private void button1_Click(object sender, EventArgs e){
HImage ho_Image = new HImage();
HRegion ho_ROI_0 = new HRegion();
HXLDCont ho_Cross = new HXLDCont();
ho_Image.ReadImage(@"F:\CYG\VirtualProject\python\162804194.jpg"); //读取图像
int width, height;
ho_Image.GetImageSize(out width,out height);
//显示图像
hWindowControl1.HalconWindow.SetPart(0,0, height,width); //先高度再宽度,没有按比例显示
hWindowControl1.HalconWindow.DispObj(ho_Image);
//显示region
ho_ROI_0.GenRectangle1(100.0, 100, 250, 250);
ho_Image.DispImage(hWindowControl1.HalconWindow);
hWindowControl1.HalconWindow.SetColor("red");
ho_ROI_0.DispRegion(hWindowControl1.HalconWindow);
////显示region
//ho_ROI_0.GenRectangle1(100.0, 100, 150, 250);
//ho_Image.DispImage(hWindowControl1.HalconWindow);
//hWindowControl1.HalconWindow.SetColor("blue");
//ho_ROI_0.DispRegion(hWindowControl1.HalconWindow);
////显示cross
//hWindowControl1.HalconWindow.SetColor("green");
//ho_Cross.GenCrossContourXld(211.0,211,200,0.78);
//ho_ROI_0.DispRegion(hWindowControl1.HalconWindow);}}}