Graphics/GraphicsRectangle.cs

(开头部分) 9KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace DrawingPad.Graphics
{
    public class GraphicsRectangle : GraphicsBase
    {
        public const int DefaultWidth = 100;
        public const int DefaultHeight = 100;

        public override GraphicsType Type { get { return GraphicsType.Rectangle; } }

        /// <summary>
        /// 左上角顶点的X
        /// </summary>
        public double Point1X { get; set; }

        /// <summary>
        /// 左上角顶点的Y
        /// </summary>
        public double Point1Y { get; set; }

        /// <summary>
        /// 矩形宽度
        /// </summary>
        public double Width { get; set; }

        /// <summary>
        /// 矩形高度
        /// </summary>
        public double Height { get; set; }

        public override void Translate(double offsetX, double offsetY)
        {
            this.Point1X += offsetX;
            this.Point1Y += offsetY;
        }

        public override void Resize(ResizeLocations location, Point oldPos, Point newPos)
        {
            switch (location)
            {
                case ResizeLocations.TopLeft:
                    {
                        double targetWidth = this.Width - (newPos.X - this.Point1X);
                        double targetHeight = this.Height - (newPos.Y - this.Point1Y);

                        if (targetWidth < PadContext.MinimalVisualSize)
                        {
                        }
                        else
                        {
                            this.Width = targetWidth;
                            this.Point1X = newPos.X;
                        }

后面还有 249 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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