ScreenToGif/Controls/ResizingAdorner.cs

(开头部分) 21KB

这里只显示每个文件的开头 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.Shapes;

namespace ScreenToGif.Controls
{
    /// <summary>
    /// The Resizing Adorner controls. https://social.msdn.microsoft.com/Forums/vstudio/en-US/274bc547-dadf-42b5-b3f1-6d29407f9e79/resize-adorner-scale-problem?forum=wpf
    /// </summary>
    public class ResizingAdorner : Adorner
    {
        #region Variables

        /// <summary>
        /// Resizing adorner uses Thumbs for visual elements.  
        /// The Thumbs have built-in mouse input handling.
        /// </summary>
        private readonly Thumb _topLeft, _topRight, _bottomLeft, _bottomRight, _middleBottom, _middleTop, _leftMiddle, _rightMiddle;

        /// <summary>
        /// The dashed border.
        /// </summary>
        private Rectangle _rectangle;

        /// <summary>
        /// To store and manage the adorner's visual children.
        /// </summary>
        readonly VisualCollection _visualChildren;

        /// <summary>
        /// The current adorned element.
        /// </summary>
        private UIElement _adornedElement;

        /// <summary>
        /// The parent of the element.
        /// </summary>
        private readonly UIElement _parent;

        /// <summary>
        /// The latest position of the element. Used by the drag operation.
        /// </summary>
        private Point _lastestPosition;

        #endregion

        /// <summary>
        /// Initialize the ResizingAdorner.
        /// </summary>
        /// <param name="adornedElement">The element to be adorned.</param>
        /// <param name="isMovable">True if it's available the drag to move action.</param>
        /// <param name="parent">The parent of the element.</param>
        /// <param name="startPosition">The start position of the first click.</param>
        public ResizingAdorner(UIElement adornedElement, bool isMovable = true, UIElement parent = null, Point? startPosition = null)
            : base(adornedElement)
后面还有 457 行代码,解锁后查看完整代码

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

AI 解读

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

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