首页 > Windows开发 > 详细

halcon HwindowCtronl 原始比例显示图片

时间:2020-05-19 17:50:10      阅读:169      评论:0      收藏:0      [点我收藏+]
    HTuple imgWidth, imgHeight;
            int winRow, winCol, winWidth, winHeight,partWidth, partHeight;
            try
            {
                HOperatorSet.GetImageSize( image,out imgWidth, out imgHeight);
                this.hWindowControl1.HalconWindow.GetWindowExtents(out winRow, out winCol, out winWidth, out winHeight);
                if (winWidth < winHeight)
                {
                    partWidth = imgWidth;
                    partHeight = imgWidth * winHeight / winWidth;
                }
                else
                {
                    partWidth = imgHeight * winWidth / winHeight;
                    partHeight = imgHeight;
                }
                this.hWindowControl1.HalconWindow.SetPart(0, 0, partHeight - 1, partWidth - 1);
                HOperatorSet.DispImage(image,this.hWindowControl1.HalconWindow);
            }
            catch (HalconException hEx)
            {
                MessageBox.Show(hEx.Message);
            }

已验证

halcon HwindowCtronl 原始比例显示图片

原文:https://www.cnblogs.com/kita/p/12918303.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!