Пример #1
0
        /*************************************************************************/
        /*                   Event handling for mouse	                         */
        /*************************************************************************/
        private void mouseDown(object sender, HalconDotNet.HMouseEventArgs 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.Forms.MouseButtons.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
        }
Пример #2
0
        /*************************************************************************/
        /*                   Event handling for mouse	                         */
        /*************************************************************************/
        private void mouseDown(object sender, HalconDotNet.HMouseEventArgs e)
        {
            double num  = (imageWidth) / ((double)this.viewPort.Size.Width);
            double num2 = (imageHeight) / ((double)this.viewPort.Size.Height);

            Location_points.Text = (string)((Math.Round((double)(e.X)) + ", " + Math.Round((double)(e.Y))));
            //    MessageBox.Show("x is " + (double)Convert.ToSingle(Math.Round((double)(e.Y * num2))) + "y is " + (double)Convert.ToSingle(Math.Round((double)(e.X * num))));
            // this.MousePoint = new My_Point((double)Convert.ToSingle(Math.Round((double)(e.Y * num2))), (double)Convert.ToSingle(Math.Round((double)(e.X * num))));



            //关闭缩放事件
            if (drawModel)
            {
                return;
            }

            stateView    = MODE_VIEW_MOVE;
            mousePressed = true;
            int activeROIidx = -1;

            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_NONE:
                    break;

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

                default:
                    break;
                }
            }
            //end of if
        }
Пример #3
0
        /*************************************************************************/
        /*                   Event handling for mouse	                         */
        /*************************************************************************/
        private void mouseDown(object sender, HalconDotNet.HMouseEventArgs e)
        {
            //关闭缩放事件
            if (drawModel)
            {
                return;
            }

            stateView    = MODE_VIEW_MOVE;
            mousePressed = true;
            int activeROIidx = -1;

            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_NONE:
                    break;

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

                default:
                    break;
                }
            }
            //end of if
        }