• 大小: 57.63MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2022-11-22
  • 语言: C#
  • 标签: C#  halcon  hWindo  拖拽  缩放  

资源简介

C#联合halcon,使用halcon控件实现通过鼠标放大缩小图片,拖拽图片。

资源截图

代码片段和文件信息

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 HalconDotNet;
using System.Drawing.Imaging;
using Emgu.CV;
using Emgu.CV.Structure;
using System.Diagnostics;
using Emgu.CV.CvEnum;
using image_processing;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        Hobject ho_Image;
        private void button7_Click(object sender EventArgs e)
        {
            HOperatorSet.ReadImage(out ho_Image @“C:\Users\Administrator\Desktop\新建文件夹 (2)\02-30-43-35.bmp“);
            HOperatorSet.DispObj(ho_Image hWindowControl1.HalconWindow);
        }
        private HalconWindow wch = new HalconWindow();
        bool flag_but_down = false;
        int btn_down_row = 0;
        int btn_down_col = 0;
        int btn_state = 0;
        private void hWindowControl1_HMouseDown(object sender HMouseEventArgs e)
        {
            flag_but_down = true;
            if (ho_Image == null) return;
            hWindowControl1.HalconWindow.GetMposition(out btn_down_row out btn_down_col out btn_state);
        }
        private void hWindowControl1_HMouseMove(object sender HMouseEventArgs e)
        {
            if (ho_Image == null) return;
            if (flag_but_down) { wch.DispImageMove(ho_Image hWindowControl1 btn_down_row btn_down_col); }
        }
        private void hWindowControl1_HMouseUp(object sender HMouseEventArgs e)
        {
            flag_but_down = false;
        }
        private void hWindowControl1_HMouseWheel(object sender HMouseEventArgs e)
        {
            if (ho_Image==null) return;
            HTuple mode = e.Delta;
            int button_state;
            int mouse_post_row mouse_pose_col;
            hWindowControl1.HalconWindow.GetMposition(out mouse_post_row out mouse_pose_col out button_state);
            wch.DispImageZoom(ho_Image hWindowControl1 mode mouse_post_row mouse_pose_col);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-03-20 16:46  halcon联合C#测试\
     目录           0  2019-03-25 14:35  halcon联合C#测试\WindowsFormsApplication1\
     文件           1  2019-03-21 10:14  halcon联合C#测试\WindowsFormsApplication1\ClassDiagram1.cd
     文件        3828  2019-03-25 14:51  halcon联合C#测试\WindowsFormsApplication1\Form1.Designer.cs
     文件        2195  2019-03-25 14:51  halcon联合C#测试\WindowsFormsApplication1\Form1.cs
     文件        6019  2019-03-25 14:51  halcon联合C#测试\WindowsFormsApplication1\Form1.resx
     文件        7631  2019-03-25 08:36  halcon联合C#测试\WindowsFormsApplication1\HalconOutput.cs
     文件        6856  2019-03-25 14:35  halcon联合C#测试\WindowsFormsApplication1\HalconWindow.cs
     文件         505  2018-08-02 11:02  halcon联合C#测试\WindowsFormsApplication1\Program.cs
     目录           0  2019-03-20 16:46  halcon联合C#测试\WindowsFormsApplication1\Properties\
     文件        1398  2018-08-02 11:02  halcon联合C#测试\WindowsFormsApplication1\Properties\AssemblyInfo.cs
     文件        2888  2018-08-02 12:02  halcon联合C#测试\WindowsFormsApplication1\Properties\Resources.Designer.cs
     文件        5612  2018-08-02 11:02  halcon联合C#测试\WindowsFormsApplication1\Properties\Resources.resx
     文件        1124  2018-08-02 12:02  halcon联合C#测试\WindowsFormsApplication1\Properties\Settings.Designer.cs
     文件         249  2018-08-02 11:02  halcon联合C#测试\WindowsFormsApplication1\Properties\Settings.settings
     文件        7167  2019-03-25 14:35  halcon联合C#测试\WindowsFormsApplication1\WindowsFormsApplication1.csproj
     文件         465  2018-10-31 08:56  halcon联合C#测试\WindowsFormsApplication1\WindowsFormsApplication1.csproj.user
     文件         159  2018-08-02 12:02  halcon联合C#测试\WindowsFormsApplication1\app.config
     目录           0  2019-03-25 14:34  halcon联合C#测试\WindowsFormsApplication1\bin\
     目录           0  2019-03-20 16:46  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\
     文件       27136  2017-10-31 01:08  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\Emgu.CV.UI.GL.dll
     文件        2242  2017-10-31 01:08  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\Emgu.CV.UI.GL.xml
     文件      117760  2017-10-31 01:08  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\Emgu.CV.UI.dll
     文件       34738  2017-10-31 01:08  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\Emgu.CV.UI.xml
     文件      622592  2017-10-31 01:08  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\Emgu.CV.World.dll
     文件     1706860  2017-10-31 01:08  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\Emgu.CV.World.xml
     文件         159  2018-08-02 12:02  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
     文件       11600  2018-08-02 12:12  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
     文件         159  2018-08-02 12:02  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
     文件         490  2010-03-17 22:39  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
     文件      307200  2017-09-03 03:57  halcon联合C#测试\WindowsFormsApplication1\bin\Debug\ZedGraph.dll
............此处省略73个文件信息

评论

共有 条评论