ScreenToGif/Controls/CroppingAdorner.cs

(开头部分) 15KB

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

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using Point = System.Drawing.Point;

namespace ScreenToGif.Controls
{
    public class CroppingAdorner : Adorner
    {
        #region Private variables

        /// <summary>
        /// The size of the Thumb in pixels.
        /// </summary>
        private const double ThumbWidth = 10;

        /// <summary>
        /// Rectangle Shape, visual aid for the cropping selection.
        /// </summary>
        private readonly PuncturedRect _cropMask;

        /// <summary>
        /// Canvas that holds the Thumb collection.
        /// </summary>
        private readonly Canvas _thumbCanvas;

        /// <summary>
        /// Corner Thumbs used to change the crop selection.
        /// </summary>
        private readonly Thumb _thumbTopLeft, _thumbTopRight, _thumbBottomLeft, 
            _thumbBottomRight, _thumbTop, _thumbLeft, _thumbBottom, _thumbRight, _thumbCenter;

        /// <summary>
        /// Stores and manages the adorner's visual children.
        /// </summary>
        private readonly VisualCollection _visualCollection;

        /// <summary>
        /// Screen DPI.
        /// </summary>
        private static readonly double DpiX, DpiY;

        #endregion

        #region Routed Events

        public static readonly RoutedEvent CropChangedEvent = EventManager.RegisterRoutedEvent(
            "CropChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(CroppingAdorner));

        public event RoutedEventHandler CropChanged
        {
            add { AddHandler(CropChangedEvent, value); }
            remove { RemoveHandler(CropChangedEvent, value); }
后面还有 436 行代码,解锁后查看完整代码

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

AI 解读

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

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