private void hwindow_HMouseDown(object sender, HalconDotNet.HMouseEventArgsWPF e)
 {
     if (ho_image != null && e.Button == MouseButton.Left)
     {
         this.GetPosition();
         isMouseLeftDown = true;
     }
     //Global.Tag = Index;
 }
 private void hwindow_HMouseWheel(object sender, HalconDotNet.HMouseEventArgsWPF e)
 {
     if (EnableWheel && ho_image != null)
     {
         HTuple mode = e.Delta;  //获取滚轮的方向
         //获取当前鼠标的位置
         this.DispImageZoom(mode);
     }
 }
 private void hwindow_HMouseMove(object sender, HalconDotNet.HMouseEventArgsWPF e)
 {
     if (isMouseLeftDown && EnableDraw == false)
     {
         this.DragImage();
     }
     else if (isMouseLeftDown == false && EnableDraw == false)
     {
         this.GetPosition();
     }
 }
Пример #4
0
        /*******************************************************************/
        private void mouseWheel(object sender, HalconDotNet.HMouseEventArgsWPF e)
        {
            double scale;

            if (e.Delta > 0)
            {
                scale = 0.9;
            }
            else
            {
                scale = 1 / 0.9;
            }
            zoomImage(e.X, e.Y, scale);
        }
Пример #5
0
        /*******************************************************************/
        private void mouseMoved(object sender, HalconDotNet.HMouseEventArgsWPF e)
        {
            double motionX, motionY;
            double posX, posY;
            double zoomZone;


            if (!mousePressed)
            {
                return;
            }

            if (roiManager != null && (roiManager.activeROIidx != -1) && (dispROI == MODE_INCLUDE_ROI))
            {
                roiManager.mouseMoveAction(e.X, e.Y);
            }
            else if (stateView == MODE_VIEW_MOVE)
            {
                motionX = ((e.X - startX));
                motionY = ((e.Y - startY));

                if (((int)motionX != 0) || ((int)motionY != 0))
                {
                    moveImage(motionX, motionY);
                    startX = e.X /*- motionX*/;
                    startY = e.Y /*- motionY*/;
                }
            }
            else if (stateView == MODE_VIEW_ZOOMWINDOW)
            {
                HSystem.SetSystem("flush_graphic", "false");
                ZoomWindow.ClearWindow();


                posX     = ((e.X - ImgCol1) / (ImgCol2 - ImgCol1)) * viewPort.ActualWidth;
                posY     = ((e.Y - ImgRow1) / (ImgRow2 - ImgRow1)) * viewPort.ActualHeight;
                zoomZone = (zoomWndSize / 2) * zoomWndFactor * zoomAddOn;

                ZoomWindow.SetWindowExtents((int)posY - (zoomWndSize / 2),
                                            (int)posX - (zoomWndSize / 2),
                                            zoomWndSize, zoomWndSize);
                ZoomWindow.SetPart((int)(e.Y - zoomZone), (int)(e.X - zoomZone),
                                   (int)(e.Y + zoomZone), (int)(e.X + zoomZone));
                repaint(ZoomWindow);

                HSystem.SetSystem("flush_graphic", "true");
                ZoomWindow.DispLine(-100.0, -100.0, -100.0, -100.0);
            }
        }
 private void hwindow_HMouseUp(object sender, HalconDotNet.HMouseEventArgsWPF e)
 {
     if (e.Button == MouseButton.Left)
     {
         isMouseLeftDown = false;
         if (GetMouseDownEvent != null)
         {
             GetMouseDownEvent(Mouse_Row, Mouse_Col);
         }
     }
     else if (e.Button == MouseButton.Middle)
     {
         DispImageFit(ho_image, false);
     }
 }
Пример #7
0
        /*******************************************************************/
        private void mouseUp(object sender, HalconDotNet.HMouseEventArgsWPF e)
        {
            mousePressed = false;

            if (roiManager != null &&
                (roiManager.activeROIidx != -1) &&
                (dispROI == MODE_INCLUDE_ROI))
            {
                roiManager.NotifyRCObserver(ROIController.EVENT_UPDATE_ROI);
            }
            else if (stateView == MODE_VIEW_ZOOMWINDOW)
            {
                ZoomWindow.Dispose();
            }
        }
Пример #8
0
        /*************************************************************************/
        /*                   Event handling for mouse	                         */
        /*************************************************************************/
        private void mouseDown(object sender, HalconDotNet.HMouseEventArgsWPF e)
        {
            mousePressed = true;
            int    activeROIidx = -1;
            double scale;

            if (roiManager != null && (dispROI == MODE_INCLUDE_ROI))
            {
                activeROIidx = roiManager.mouseDownAction(e.X, e.Y);
            }

            if (activeROIidx == -1)
            {
                switch (stateView)
                {
                case MODE_VIEW_MOVE:
                    startX = e.X;
                    startY = e.Y;
                    break;

                //case MODE_VIEW_ZOOM:
                //    if (e.Button == System.Windows.Input.MouseButton.Left)
                //        scale = 0.9;
                //    else
                //        scale = 1 / 0.9;
                //    zoomImage(e.X, e.Y, scale);
                //    break;
                case MODE_VIEW_NONE:
                    break;

                case MODE_VIEW_ZOOMWINDOW:
                    activateZoomWindow((int)e.X, (int)e.Y);
                    break;

                default:
                    break;
                }
            }
            //end of if
        }
Пример #9
0
 private void WPF_HWindow_HMouseDown(object sender, HalconDotNet.HMouseEventArgsWPF e)
 {
     //Console.WriteLine("col:" + e.Column + ",row:" + e.Row);
     //Console.WriteLine("X:" + e.X + ",Y:" + e.Y);
     //Console.WriteLine("1");
 }