halcon HwindowCtronl 鼠标滚轮缩放代码

Posted kita

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了halcon HwindowCtronl 鼠标滚轮缩放代码相关的知识,希望对你有一定的参考价值。

            try
            {
                bool flag = e.Delta > 0;
                if (flag)
                {
                    HTuple htuple = 1.0;
                    HTuple htuple2 = 1.0;
                    HTuple htuple3 = 1.0;
                    bool flag2 = htuple >= 32.0;
                    if (flag2)
                    {
                        htuple = 32.0;
                    }
                    else
                    {
                        htuple *= 1.1;
                    }
                    htuple3 = htuple / htuple2;
                    HTuple htuple4;
                    HTuple htuple5;
                    HTuple htuple6;
                    HOperatorSet.GetMposition(this.hWindowControl1.HalconWindow, out htuple4, out htuple5, out htuple6);
                    HTuple htuple7;
                    HTuple htuple8;
                    HTuple htuple9;
                    HTuple htuple10;
                    HOperatorSet.GetPart(this.hWindowControl1.HalconWindow, out htuple7, out htuple8, out htuple9, out htuple10);
                    HTuple htuple11 = htuple9 - htuple7;
                    HTuple htuple12 = htuple10 - htuple8;
                    HTuple htuple13 = htuple7 + (1 - 1.0 / htuple3) * (htuple4 - htuple7);
                    HTuple htuple14 = htuple8 + (1 - 1.0 / htuple3) * (htuple5 - htuple8);
                    HTuple htuple15 = htuple13 + htuple11 / htuple3;
                    HTuple htuple16 = htuple14 + htuple12 / htuple3;
                    HOperatorSet.SetPart(this.hWindowControl1.HalconWindow, htuple13, htuple14, htuple15, htuple16);
                    HOperatorSet.ClearWindow(this.hWindowControl1.HalconWindow);
                    this.Fun_display();
                }
                else
                {
                    HTuple htuple17 = 1.0;
                    HTuple htuple18 = 1.0;
                    HTuple htuple19 = 1.0;
                    bool flag3 = htuple17 <= 0.0625;
                    if (flag3)
                    {
                        htuple17 = 0.0625;
                    }
                    else
                    {
                        htuple17 /= 1.1;
                    }
                    htuple19 = htuple17 / htuple18;
                    HTuple htuple20;
                    HTuple htuple21;
                    HTuple htuple22;
                    HOperatorSet.GetMposition(this.hWindowControl1.HalconWindow, out htuple20, out htuple21, out htuple22);
                    HTuple htuple23;
                    HTuple htuple24;
                    HTuple htuple25;
                    HTuple htuple26;
                    HOperatorSet.GetPart(this.hWindowControl1.HalconWindow, out htuple23, out htuple24, out htuple25, out htuple26);
                    HTuple htuple27 = htuple25 - htuple23;
                    HTuple htuple28 = htuple26 - htuple24;
                    HTuple htuple29 = htuple23 + (1 - 1.0 / htuple19) * (htuple20 - htuple23);
                    HTuple htuple30 = htuple24 + (1 - 1.0 / htuple19) * (htuple21 - htuple24);
                    HTuple htuple31 = htuple29 + htuple27 / htuple19;
                    HTuple htuple32 = htuple30 + htuple28 / htuple19;
                    HOperatorSet.SetPart(this.hWindowControl1.HalconWindow, htuple29, htuple30, htuple31, htuple32);
                    HOperatorSet.ClearWindow(this.hWindowControl1.HalconWindow);
                    this.Fun_display();
                }
            }
            catch (Exception ex)
            {
            }

经过验证可正常实现功能,欢迎提出改进意见。

以上是关于halcon HwindowCtronl 鼠标滚轮缩放代码的主要内容,如果未能解决你的问题,请参考以下文章

如何禁用鼠标的滚轮?

centos7触屏鼠标滚轮

ulli鼠标滚轮水平滚动

电脑鼠标滚轮不能滑动怎么办 电脑鼠标滚轮不能滑动处理方法

如何禁用鼠标滚轮?

如果单独设置mac鼠标滚轮方向?