设置首页收藏本站
开启左侧

How to draw an xld contour on HSmartWindowControl?

[复制链接]
Evgeniy 发表于 2021-7-15 14:15:58 | 显示全部楼层 |阅读模式
Привет, коллеги!

У меня есть вопрос.

Как нарисовать контур xld на HSmartWindowControl?

Я использую новый созданный экземпляр HSmartWindowControl для рисования некоторого контура xld, и после этого я закрываю этот экземпляр и созданный контур XLD перемещается в мой HSmarrtWindowControl на форме . Но это

неудобно ! Мне нужно нарисовать XLD ON Текущий HSmartWindowControl (SmartWin) ON Форма без создания нового экземпляра.

Теперь я делаю это так:

Private List <HXLDCont> Regions = new new List < HXLDCont> ();.
..


            bSetPatternPoints.Click + = (s, e) =>
            {
                Объект
                HObject ; SmartWin.HalconWindow.SetWindowParam ("flush", "false");

                double r1, c1, r2, c2;
                HSmartWindowControl newWin = new HSmartWindowControl ();
                newWin.HalconWindow.OpenWindow (0, 0, 600, 600, 0, "видимый", "");
                newWin.HalconWindow.DispObj (background_image);
                newWin.HalconWindow.SetColor (новый HTuple (ColorToHalconColorWithOpacity (ColorTranslator.FromHtml ("# 00FF0C"), 255)));
                newWin.HalconWindow.SetLineWidth (2);
                HXLDCont contour = newWin.HalconWidth, "," истина "," истина ");
                newWin.HalconWindow.CloseWindow ();

                SmartWin.HalconWindow.DispObj (background_image);
                SmartWin.HalconWindow.SetColor (новый HTuple (ColorToHalconColorWithOpacity (ColorTranslator.FromHtml ("# 00FF0C"), 255)));
                SmartWin.HalconWindow.SetLineWidth (2);

                SmartWin.HalconWindow.SetWindowParam ", false"
                SmartWin.HalconWindow.ClearWindow ();
                SmartWin.HalconWindow.DispObj (background_image);

                SmartWin.HalconWindow.DispXld (контур);
                SmartWin.HalconWindow.SetWindowParam ( "заподлицо", "истина");
                SmartWin.HalconWindow.FlushBuffer ();

                регионы .Add (контур);

                SmartWinManager.RedrawAllObjects (SmartWin.HalconWindow);
            };

Проблема в том, что мой текущий элемент управления (SmartWin) зависает после вызова оператора DrawXld. Но если я создал новый экземпляр того же класса и использовал оператор OpenWindow, тогда все работает нормально.

Вы можете мне помочь?

奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
 楼主| Evgeniy 发表于 2021-7-15 14:17:56 | 显示全部楼层
Hi, colleagues!

I have a question.

How to draw an xld contour on HSmartWindowControl?

I am using new created instance of HSmartWindowControl for drawing some xld contour and after that I am closed this instance and created XLD contour moved to my HSmarrtWindowControl on the form. But It is not comfortable!

I need to draw XLD on current HSmartWindowControl (SmartWin) on the form without creating of new instance.

Now I do this like that:

private List<HXLDCont> regions = new List<HXLDCont>();
...


            bSetPatternPoints.Click += (s, e) =>
            {
                HObject Object;
                SmartWin.HalconWindow.SetWindowParam("flush", "false");

                double r1, c1, r2, c2;
                HSmartWindowControl newWin = new HSmartWindowControl();
                newWin.HalconWindow.OpenWindow(0, 0, 600, 600, 0, "visible", "");
                newWin.HalconWindow.DispObj(background_image);
                newWin.HalconWindow.SetColor(new HTuple(ColorToHalconColorWithOpacity(ColorTranslator.FromHtml("#00FF0C"), 255)));
                newWin.HalconWindow.SetLineWidth(2);
                HXLDCont contour = newWin.HalconWindow.DrawXld("true", "true", "true", "true");
                newWin.HalconWindow.CloseWindow();

                SmartWin.HalconWindow.DispObj(background_image);
                SmartWin.HalconWindow.SetColor(new HTuple(ColorToHalconColorWithOpacity(ColorTranslator.FromHtml("#00FF0C"), 255)));
                SmartWin.HalconWindow.SetLineWidth(2);

                SmartWin.HalconWindow.SetWindowParam("flush", "false");
                SmartWin.HalconWindow.ClearWindow();
                SmartWin.HalconWindow.DispObj(background_image);

                SmartWin.HalconWindow.DispXld(contour);
                SmartWin.HalconWindow.SetWindowParam("flush", "true");
                SmartWin.HalconWindow.FlushBuffer();

                regions.Add(contour);

                SmartWinManager.RedrawAllObjects(SmartWin.HalconWindow);
            };

The problem is that my current control (SmartWin) is freezes after calling operator DrawXld. But if I created the new instance of the same class and used operator OpenWindow, then all works fine.

Can you help me?
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表