Beispiel #1
0
        public void OnMouseWheel(MouseEventArgs e)
        {
            double Factor;

            if (e.Delta > 0)
            {
                Factor = 1.0 / 1.1;
            }
            else if (e.Delta < 0)
            {
                Factor = 1.1;
            }
            else
            {
                return;
            }
            Rectangle    clr = canvas.ClientRectangle;
            BoundingRect rct = new BoundingRect(clr.Left, clr.Bottom, clr.Right, clr.Top);

            rct.Modify(screenToLayout);
            System.Drawing.Point p = new System.Drawing.Point(e.X, e.Y);
            p = canvas.PointToClient(Frame.UIService.CurrentMousePosition);
            GeoPoint2D p2 = screenToLayout * new GeoPoint2D(p.X, p.Y);

            rct.Right  = p2.x + (rct.Right - p2.x) * Factor;
            rct.Left   = p2.x + (rct.Left - p2.x) * Factor;
            rct.Bottom = p2.y + (rct.Bottom - p2.y) * Factor;
            rct.Top    = p2.y + (rct.Top - p2.y) * Factor;
            (this as IView).ZoomToRect(rct);
            (this as IView).InvalidateAll();
        }
Beispiel #2
0
        public void ZoomDelta(double f)
        {
            double Factor = f;

            System.Drawing.Rectangle clr = canvas.ClientRectangle;
            System.Drawing.Point     p   = new System.Drawing.Point((clr.Left + clr.Right) / 2, (clr.Bottom + clr.Top) / 2);
            BoundingRect             rct = new BoundingRect(clr.Left, clr.Bottom, clr.Right, clr.Top);

            rct.Modify(screenToLayout);
            GeoPoint2D p2 = screenToLayout * new GeoPoint2D(p.X, p.Y);

            rct.Right  = p2.x + (rct.Right - p2.x) * Factor;
            rct.Left   = p2.x + (rct.Left - p2.x) * Factor;
            rct.Bottom = p2.y + (rct.Bottom - p2.y) * Factor;
            rct.Top    = p2.y + (rct.Top - p2.y) * Factor;
            (this as IView).ZoomToRect(rct);
            (this as IView).InvalidateAll();
        }