コード例 #1
0
        protected void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            e.Handled = true;
            Point curContentMousePoint = e.GetPosition(content);

            if (e.Delta > 0)
            {
                ZoomIn(curContentMousePoint);
            }
            else if (e.Delta < 0)
            {
                // don't allow zoomout les that original image
                if (ZoomAndPanControlMacro.ContentScale - 0.1 > ZoomAndPanControlMacro.FitScale())
                {
                    ZoomAndPanControlMacro.ZoomOut(curContentMousePoint);
                }
                else
                {
                    ZoomAndPanControlMacro.ScaleToFit();
                }
                ZoomOut(curContentMousePoint);
            }
            if (ZoomAndPanControlMacro.ContentScale > ZoomAndPanControlMacro.FitScale())
            {
                LoadFullRes();
                ImageListViewModel.FreeZoom = true;
            }
        }
コード例 #2
0
        private void ZoomAndPanControl_ContentScaleChanged(object sender, EventArgs e)
        {
            GeneratePreview();
            var i = Math.Round(ZoomAndPanControlMacro.FitScale(), 4);

            ImageListViewModel.FreeZoom = Math.Round(ZoomAndPanControlMacro.ContentScale, 4) >
                                          Math.Round(ZoomAndPanControlMacro.FitScale(), 4);
            if (!ImageListViewModel.FreeZoom)
            {
                ImageListViewModel.ZoomFit = true;
            }
        }