예제 #1
0
 /// <summary>
 /// Handles the SizeChanged event of the HalconWindowControl control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void HalconWindowControl_SizeChanged(object sender, EventArgs e)
 {
     if (sender is HSmartWindowControl)
     {
         if (halconImage.IsValid())
         {
             halconWindow.SetPart(0, 0, halconImage.Height, halconImage.Width);
             halconWindow.DispImage(halconImage);
         }
         //toolStripStatusLabel1.Text = "Width = " + (sender as HSmartWindowControl).Width;
         //toolStripStatusLabel2.Text = "Height = " + (sender as HSmartWindowControl).Height;
     }
 }
예제 #2
0
        private void RefreshHalconScreen()
        {
            if (_windowHandle == null)
            {
                return;
            }
            _windowHandle.ClearWindow();
            var result2D = SocketToDisplay == CavityType.Cavity1 ? LeftGraphics : RightGraphics;

            UpdateImageIndexList(result2D);
            if (result2D.Images == null || result2D.Images.Count == 0)
            {
                return;
            }
            var image    = result2D.Images[ImageIndexToDisplay];
            var graphics = result2D.Graphics;

            _windowHandle.DispImage(image);
            if (graphics != null)
            {
                _windowHandle.DispObj(graphics);
            }
            var errorMessage = result2D.ErrorMessage;

            if (errorMessage != null)
            {
                _windowHandle.DispText(errorMessage, "window", 20, 20, "red", "border_radius", 2);
            }
        }
예제 #3
0
 void clearDisplay()
 {
     hWindow.ClearWindow();
     graphicsQueue.Clear();
     hImage.GetImageSize(out width, out height);
     hWindow.SetPart(0, 0, height, width);
     hWindow.DispImage(hImage);
 }
예제 #4
0
        private void hSmartWindowControl1_HInitWindow(object sender, EventArgs e)
        {
            HWindow    hWindow    = (sender as HSmartWindowControl).HalconWindow;
            HTextModel hTextModel = new HTextModel("auto", "Industrial_Rej");
            HImage     hImage     = new HImage("ocr/medication_package_02_right");


            HTextResult hTextResult = hImage.FindText(hTextModel);
            HObject     hTextLine   = hTextResult.GetTextObject(new HTuple("line", 0));

            hWindow.SetColored(3);
            hWindow.DispImage(hImage);
            hWindow.DispObj(hTextLine);
            hSmartWindowControl1.SetFullImagePart(null);
        }