예제 #1
0
        public void ZoomToHeight()
        {
            double    scrollBarHeight = scrollViewer.ComputedHorizontalScrollBarVisibility == System.Windows.Visibility.Visible ? SystemParameters.HorizontalScrollBarHeight : 0;
            double    zoomFactor      = (parent.ActualHeight - scrollBarHeight) / parent.PageBounds[pageIndex].SizeIncludingOffset.Height;
            PageBound pageBound       = parent.PageBounds[pageIndex];

            if (scrollBarHeight == 0 && ((pageBound.Size.Width * zoomFactor) + pageBound.HOffset) >= parent.ActualWidth)
            {
                scrollBarHeight += SystemParameters.HorizontalScrollBarHeight;
            }

            zoomFactor = (parent.ActualHeight - scrollBarHeight) / parent.PageBounds[pageIndex].SizeIncludingOffset.Height;
            ZoomInternal(zoomFactor);
        }
예제 #2
0
        public void ZoomToWidth()
        {
            double    scrollBarWidth = scrollViewer.ComputedVerticalScrollBarVisibility == System.Windows.Visibility.Visible ? SystemParameters.VerticalScrollBarWidth : 0;
            double    zoomFactor     = (parent.ActualWidth - scrollBarWidth) / parent.PageBounds[pageIndex].SizeIncludingOffset.Width;
            PageBound pageBound      = parent.PageBounds[pageIndex];

            if (scrollBarWidth == 0 && ((pageBound.Size.Height * zoomFactor) + pageBound.VOffset) >= parent.ActualHeight)
            {
                scrollBarWidth += SystemParameters.VerticalScrollBarWidth;
            }

            scrollBarWidth += 2;
            zoomFactor      = (parent.ActualWidth - scrollBarWidth) / parent.PageBounds[pageIndex].SizeIncludingOffset.Width;
            ZoomInternal(zoomFactor);
        }