WindowsFormsApp/FrmDrawImage.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Emgu.CV.UI;
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;
namespace WindowsFormsApp
{
public partial class FrmDrawImage : Form
{
public FrmDrawImage()
{
InitializeComponent();
this.imageBox1.MouseWheel += Form1_MouseWheel;
}
/// <summary>
/// 当前图像的放缩比例
/// </summary>
private double _CurrentZoomScale = 1.0D;
/// <summary>
/// 处理鼠标事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Form1_MouseWheel(object sender, MouseEventArgs e)
{
if (e.Delta > 0)
{
_CurrentZoomScale *= 1.5;
}
else
{
_CurrentZoomScale *= 0.5;
}
// 设置放缩比例
this.imageBox1.SetZoomScale(_CurrentZoomScale, new Point(100, 200));
//this.imageBox1.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
//ImageBox
imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.Minimum;
//imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.PanAndZoom;
//this.imageBox1.SizeMode = PictureBoxSizeMode.Zoom;
this.imageBox1.ImageLocation = Application.StartupPath + @"\\pic\\ss.jpg";
}
private void imageBox1_OnZoomScaleChange(object sender, EventArgs e)
{
Console.WriteLine(this.imageBox1.ZoomScale);
//Console.WriteLine(string.Format("当前图像大小,ZoomScale:{0},Width:{1},Height:{2}", this.imageBox1.ZoomScale, this.imageBox1.Width, this.imageBox1.Height));
后面还有 5 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
