ScreenToGif.Pages.Crop.Crop C# (CSharp) Method

Crop() public method

The constructor of the Croping tool.
public Crop ( Bitmap bitmap ) : System
bitmap Bitmap The example of bitmap.
return System
        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

            _g = pictureCrop.CreateGraphics();

            #region Localize Labels

            this.Text = Resources.Title_CropNoSelection;

            #endregion

            pictureCrop.Focus();
        }