GifRecorder/Pages/Crop.cs

(开头部分) 6KB

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

using System;
using System.Drawing;
using System.Windows.Forms;
using ScreenToGif.Properties;
using Color = System.Drawing.Color;
using Pen = System.Drawing.Pen;

namespace ScreenToGif.Pages
{
    /// <summary>
    /// Form used to crop images.
    /// </summary>
    public partial class Crop : Form
    {
        #region Variables

        private readonly Bitmap _bitmap;
        private Graphics _g;
        readonly Pen _pen = new Pen(Color.Blue, 2F);
        private Rectangle _rectangle;
        private int _posX, _posY, _width, _height, _posXmove, _posYmove;

        /// <summary>
        /// The area to cut.
        /// </summary>
        public Rectangle Rectangle
        {
            get { return _rectangle; }
            set { _rectangle = value; }
        }

        #endregion

        /// <summary>
        /// The constructor of the Croping tool.
        /// </summary>
        /// <param name="bitmap">The example of bitmap.</param>
        public Crop(Bitmap bitmap)
        {
            InitializeComponent();

            this.Size = new Size(bitmap.Size.Width + 40, bitmap.Size.Height + 80);

            pictureCrop.Size = bitmap.Size;
            pictureCrop.Image = bitmap;
            _bitmap = new Bitmap(bitmap);

            #region If image is smaller than 120x100

            if (bitmap.Size.Width < 320)
            {
                this.Size = new Size(320 + 40, bitmap.Size.Height);
            }

            if (bitmap.Size.Height < 100)
            {
                this.Size = new Size(this.Size.Width, 100 + 80);
            }

            #endregion
后面还有 178 行代码,解锁后查看完整代码

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

AI 解读

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

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