Beispiel #1
0
        private void ImageScrollViewer_OnSetSize(ImageScrollViewer viewer, MouseWheelEventArgs e)
        {
            Point point = e.GetPosition(imgContainer);

            xScale = point.X / imgContainer.Width;
            yScale = point.Y / imgContainer.Height;

            if (e.Delta > 0 && (imgContainer.Width + SCROLL_SPEED <= MAX_WIDTH || imgContainer.Height + SCROLL_SPEED <= MAX_HEIGHT))
            {
                imgContainer.Width  += SCROLL_SPEED;
                imgContainer.Height += SCROLL_SPEED;
                isScroll             = true;
            }
            else if (e.Delta < 0 && (imgContainer.Width - SCROLL_SPEED >= MIN_WIDTH || imgContainer.Height - SCROLL_SPEED >= MIN_HEIGHT))
            {
                imgContainer.Width  -= SCROLL_SPEED;
                imgContainer.Height -= SCROLL_SPEED;
                isScroll             = true;
            }
        }
Beispiel #2
0
 private void ImageScrollViewer_OnMouseMove(ImageScrollViewer viewer, MouseEventArgs e)
 {
     viewer.ScrollToHorizontalOffset(xOffset + orign.X - e.GetPosition(this).X);
     viewer.ScrollToVerticalOffset(yOffset + orign.Y - e.GetPosition(this).Y);
 }
Beispiel #3
0
 private void ImageScrollViewer_OnMouseDown(ImageScrollViewer viewer, MouseEventArgs e)
 {
     orign   = e.GetPosition(this);
     xOffset = viewer.HorizontalOffset;
     yOffset = viewer.VerticalOffset;
 }