예제 #1
0
        public override void OnMouseDown(ZWPictureBox pictureBox, MouseEventArgs e)
        {
            LaserAlignment laserAlignment = CtrlFactory.GetCtrlFactory().GetCtrlByType <LaserAlignment>(CtrlType.LaserAlignment);

            if (e.Button == MouseButtons.Left /*&& IsClickLaser(e.Location)*/ && laserAlignment.Index > -1)
            {
                count++;
                if (count == 1)
                {
                    ZoomHandler?.Invoke(e, true);
                    ButtonStateHandler?.Invoke(false);
                }
                else if (count == 2)
                {
                    IsShowCross = true;
                    Count       = 0;
                    ButtonStateHandler?.Invoke(true);
                }
            }
        }
예제 #2
0
        public override void OnMouseDown(RichPictureBox richPictureBox, MouseEventArgs e)
        {
            LaserAlignment laserAlignment = CtrlFactory.GetCtrlFactory().GetCtrlByType <LaserAlignment>(CtrlType.LaserAlignment);

            if (e.Button == MouseButtons.Left /*&& IsClickLaser(e.Location)*/ && laserAlignment.Index > -1)
            {
                //count++;
                if (ZoomView)
                {
                    if (richPictureBox.Zoom != Program.SysConfig.DefaultScaleCoefficient)
                    {
                        ZoomHandler?.Invoke(e, true);
                        //ButtonStateHandler?.Invoke(false);
                    }
                    else
                    {
                        IsShowCross = true;
                        ButtonStateHandler?.Invoke(true);
                        PointF pointF = new PointF(e.Location.X /* / richPictureBox.Zoom*/, e.Location.Y /* / richPictureBox.Zoom*/);
                        ClickPoint = Point.Ceiling(pointF);
                        Coordinate.GetCoordinate().AddPoint(Index, pointF);
                    }
                    ZoomView = false;
                }
                else
                {
                    IsShowCross = true;
                    //ClickPoint = e.Location;
                    Count = 0;
                    ButtonStateHandler?.Invoke(true);
                    //PointF pointF = new PointF(e.Location.X/* / richPictureBox.Zoom*/, e.Location.Y/* / richPictureBox.Zoom*/);
                    PointF pointF = new PointF(e.Location.X / richPictureBox.Zoom - richPictureBox.OffsetX, e.Location.Y / richPictureBox.Zoom - richPictureBox.OffsetY);
                    ClickPoint = Point.Ceiling(pointF);
                    Coordinate.GetCoordinate().AddPoint(Index, pointF);
                    //Console.WriteLine("add point: " + pointF.ToString());
                }
                //Console.WriteLine(e.Location.ToString());
            }
        }