Exemplo n.º 1
0
        public void ZoomRatio(double zoom_ratio, double x, double y)
        {
            if (zoom_ratio < 0)
            {
                return;
            }
            System.Windows.Point point  = new System.Windows.Point(x, y);
            System.Windows.Point center = new System.Windows.Point(0.0, 0.0);
            point = new System.Windows.Point(point.X - this.Bg.ActualWidth / 2.0, point.Y - this.Bg.ActualHeight / 2.0);
            System.Windows.Point point2 = point;
            double x2 = point2.X + msi.ActualWidth / 2.0;
            double y2 = point2.Y + msi.ActualHeight / 2.0;

            System.Windows.Point elementPoint = new System.Windows.Point(x2, y2);
            System.Windows.Point point3       = msi.ElementToLogicalPoint(elementPoint);
            msi.ZoomAboutLogicalPoint(zoom_ratio / curscale, point3.X, point3.Y);
            curscale = zoom_ratio;
        }
Exemplo n.º 2
0
 //
 // Summary:
 //     Enables a user to zoom in on a point of the System.Windows.Controls.MultiScaleImage.
 //
 // Parameters:
 //   zoomIncrementFactor:
 //     Specifies the zoom. This number is greater than 0. A value of 1 specifies
 //     that the image fit the allotted page size exactly. A number greater than
 //     1 specifies to zoom in. If a value of 0 or less is used, failure is returned
 //     and no zoom changes are applied.
 //
 //   zoomCenterLogical:
 //     the point on the System.Windows.Controls.MultiScaleImage
 //     that is zoomed in on. This is a logical point (its coordinates are between 0 and 1).
 public static void ZoomAboutLogicalPoint(this MultiScaleImage img, double zoomIncrementFactor, Point zoomCenterLogical)
 {
     img.ZoomAboutLogicalPoint(zoomIncrementFactor, zoomCenterLogical.X, zoomCenterLogical.Y);
 }