ScreenToGif/Controls/ImageScrollViewer.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace ScreenToGif.Controls
{
    public class ImageScrollViewer : ScrollViewer
    {
        #region Variables

        public readonly static DependencyProperty ImageSourceProperty;
        public readonly static DependencyProperty ZoomProperty;

        private Point? _lastCenterPositionOnTarget;
        private Point? _lastMousePositionOnTarget;
        private Point? _lastDragPoint;

        private ScaleTransform _scaleTransform;
        private Grid _grid;

        #endregion

        #region Properties

        /// <summary>
        /// The image source.
        /// </summary>
        [Description("The image source.")]
        public string ImageSource
        {
            get { return (string)GetValue(ImageSourceProperty); }
            set { SetValue(ImageSourceProperty, value); }
        }

        /// <summary>
        /// The zoom level of the control.
        /// </summary>
        [Description("The zoom level of the control.")]
        public Double Zoom
        {
            get { return (Double)GetValue(ZoomProperty); }
            set
            {
                SetCurrentValue(ZoomProperty, value);

                //Should I control the max-min here?
                if (value < 0.1)
                {
                    Zoom = 0.1;
                }
                if (value > 5.0)
                {
                    Zoom = 5;
后面还有 233 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。