halcon窗体的移动和缩放_halcon与C#联合编程之鼠标控制图片缩放,拖动,roi

本实例详细介绍了如何使用Halcon与C#进行联合编程,实现鼠标控制图片的缩放、拖动以及ROI选择功能。通过Halcon的API和C#窗体事件,用户可以实现对图像的实时交互操作。
摘要由CSDN通过智能技术生成

【实例简介】本实例展示了halcon与C#联合编程之鼠标控制图片缩放,拖动,roi

【实例截图】

【核心代码】using ChoiceTech.Halcon.Control;

using HalconDotNet;

using Microsoft.CSharp;

using System;

using System.CodeDom.Compiler;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.IO;

using System.Linq;

using System.Reflection;

using System.Text;

using System.Threading;

using System.Windows.Forms;

namespace HalconPaint

{

public partial class PaintForm : Form

{

private HObject image = new HObject();//图片

private HObject brush_region = new HObject();//笔刷

private HObject final_region = new HObject();//需要获得的区域

private HTuple hv_WindowHandle;

public PaintForm()

{

InitializeComponent();

//hv_WindowHandle = hWindow_Final1.HWindowHalconID;

}

///

/// 窗体加载

///

///

///

private void VisionForm_Load(object sender, EventArgs e)

{

try

{

HOperatorSet.ReadImage(out image, "kk.bmp");

hWindow_Final1.HobjectToHimage(image);

}

catch (Exception)

{

throw;

}

}

///

/// 设置笔刷

///

///

///

private void button_brush_Click(object sender, EventArgs e)

{

string brushType = ((Button)sender).Text;//笔刷类型

HTuple hv_Row1 = null, hv_Column1 = null, hv_Row2 = null, hv_Column2 = null;

HObject ho_temp_brush = new HObject();

try

{

//画图模式 开

hWindow_Final1.DrawModel = true;

hWindow_Final1.Focus();

//锁住功能区

groupBox_tool.Enabled = false;

//显示提示

hWindow_Final1.ClearWindow();

hWindow_Final1.HobjectToHimage(image);

HalconTo

  • 1
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值