1.代码一
//此部分只实现了图像的鼠标滚轮缩放与空格复位功能
private void pictureBox_SingleMain_HMouseWheel(object sender, MouseEventArgs e)
{
HTuple Zoom, Row, Col, Button;
HTuple Row0, Column0, Row00, Column00, Ht, Wt, r1, c1, r2, c2;
if (e.Delta > 0)
{
Zoom = 1.5;
}
else
{
Zoom = 0.5;
}
HOperatorSet.GetMposition(hv_WindowHandle, out Row, out Col, out Button);
HOperatorSet.GetPart(hv_WindowHandle, out Row0, out Column0, out Row00, out Column00);
Ht = Row00 - Row0;
Wt = Column00 - Column0;
if (Ht * Wt < 32000 * 32000 || Zoom == 1.5)//普通版halcon能处理的图像最大尺