Beispiel #1
0
        private void ZoomRight()
        {
            double dx = _worldScale.ScreenToRealDistance(picWorld.Height / 60f);
            double dy = 0;

            _worldScale = CreateWorldScale(_worldScale.Factor, RealPoint.Shift(GetCenter(), dx, dy));
            picWorld.Invalidate();
        }
Beispiel #2
0
        private void ZoomStep()
        {
            double dx = _worldScale.ScreenToRealDistance(picWorld.Height / 60f) * _moveHorizontal;
            double dy = _worldScale.ScreenToRealDistance(picWorld.Height / 60f) * _moveVertical;

            _worldScale = CreateWorldScale(_worldScale.Factor + _moveZoom, RealPoint.Shift(GetCenter(), dx, dy));
            //_worldScale = CreateWorldScale(_worldScale.Factor + _moveZoom, GetCenter());

            picWorld.Invalidate();
        }
Beispiel #3
0
        private void ZoomStepParam()
        {
            if (_step < 20)
            {
                _worldScale = CreateWorldScale(_worldScale.Factor, RealPoint.Shift(GetCenter(), _moveHorizontal, _moveVertical));
            }
            else if (_step < 40)
            {
                _worldScale = CreateWorldScale(_worldScale.Factor - _moveZoom, GetCenter());
            }

            _step++;
            if (_step == 40)
            {
                _moveHorizontal = 0;
                _moveVertical   = 0;
                _moveZoom       = 0;
            }

            picWorld.Invalidate();
        }
Beispiel #4
0
        private void picWorld_MouseMove(object sender, MouseEventArgs e)
        {
            RealPoint pos = PicCoordinates();

            lblPosition.Text = "X = " + pos.X.ToString().PadLeft(4) + ": Y = " + pos.Y.ToString().PadLeft(4);

            if (_startPoint != null)
            {
                if (_shapeMode == ShapeMode.Zoom)
                {
                    double dx      = pos.X - _startPoint.X;
                    double dy      = pos.Y - _startPoint.Y;
                    double finalDx = dx;
                    double finalDy = dy;

                    _rectZoomOrg = new PolygonRectangle(_startPoint, dx, dy);

                    if (Math.Abs(dx / dy) > Math.Abs(picWorld.Width / picWorld.Height))
                    {
                        finalDx = Math.Sign(dx) * (picWorld.Width * (Math.Abs(dy) / picWorld.Height));
                    }
                    else
                    {
                        finalDy = Math.Sign(dy) * (picWorld.Height * (Math.Abs(dx) / picWorld.Width));
                    }

                    _rectZoomFinal = new PolygonRectangle(RealPoint.Shift(_startPoint, -(finalDx - dx) / 2, -(finalDy - dy) / 2), finalDx, finalDy);
                }
                else if (_shapeMode != ShapeMode.None)
                {
                    _currentShape = BuildCurrentShape(_shapeMode, _startPoint, pos);
                    lblItem.Text  = _currentShape.GetType().Name + " : " + _currentShape.ToString();
                }

                picWorld.Invalidate();
            }
        }