示例#1
0
        private void InitialBGImage()
        {
            this._bgOriginalImageMaxSize = PictureControl.ColculateTrackBarMaxSize(
                this.backgroundPictureBox.Width,
                this.backgroundPictureBox.Height);

            this.trackBarBGControl.Properties.Maximum = this._bgOriginalImageMaxSize;

            this.trackBarBGControl.Value = 0;
        }
示例#2
0
        private void InitialFGImage()
        {
            this._ezdOriginalImageMaxSize = PictureControl.ColculateTrackBarMaxSize(
                this.foregroundPictureBox.Width,
                this.foregroundPictureBox.Height);

            this.trackBarFGControl.Properties.Maximum = this._ezdOriginalImageMaxSize + 300;

            this.trackBarFGControl.Value = this.trackBarFGControl.Properties.Maximum;
        }
示例#3
0
 private void TrackBarFGControl_ValueChanged(object sender, EventArgs e)
 {
     if (this._ezdOriginalImage != null)
     {
         this.foregroundPictureBox.Image = PictureControl.Scale(
             this._ezdOriginalImage,
             new Size(
                 this._ezdOriginalImageMaxSize - this.trackBarFGControl.Value,
                 this._ezdOriginalImageMaxSize - this.trackBarFGControl.Value));
     }
 }
示例#4
0
 private void TrackBarBGControl_ValueChanged(object sender, EventArgs e)
 {
     if (this._bgOriginalImage != null)
     {
         if (this.scale_bg)
         {
             this.backgroundPictureBox.Image = PictureControl.Scale(
                 this._bgOriginalImage,
                 new Size(this.trackBarBGControl.Value, this.trackBarBGControl.Value));
         }
         else
         {
             this.backgroundPictureBox.Image = PictureControl.Zoom(
                 this._bgOriginalImage,
                 new Size(this.trackBarBGControl.Value, this.trackBarBGControl.Value));
         }
     }
 }
示例#5
0
        private void Upload(UploadType type)
        {
            // take filter type
            var filter = type == UploadType.Ezd
                             ? @"EZD file (*.ezd) | *.ezd"
                             : @"Image files (*.jpg, *.jpeg, *.png) | *.jpg; *.jpeg; *.png";

            using (var ofd = new OpenFileDialog {
                Multiselect = false, ValidateNames = true, Filter = filter
            })
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    // take BG|FG image from fileName
                    if (type == UploadType.Ezd)
                    {
                        try
                        {
                            this.LoadImage(ofd.FileName);
                        }
                        catch (Exception ex)
                        {
                            XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
                        }
                    }
                    else
                    {
                        var img = Image.FromFile(ofd.FileName);

                        if (img.Width > ClientRectangle.Width)
                        {
                            var residue = img.Width - ClientRectangle.Width;

                            int percent = (int)(decimal.Divide(residue, img.Width) * 100);

                            img = PictureControl.Scale(img, new Size(percent, percent));

                            this.scale_bg = true;
                        }
                        else
                        {
                            this.scale_bg = false;
                        }

                        if (img.Height > ClientRectangle.Height)
                        {
                            var residue = img.Height - ClientRectangle.Height;

                            var percent = (int)(decimal.Divide(residue, img.Height) * 100);

                            img = PictureControl.Scale(img, new Size(percent, percent));

                            this.scale_bg = true;
                        }

                        this.backgroundPictureBox.Image = img;

                        this.backgroundPictureBox.Width  = img.Width;
                        this.backgroundPictureBox.Height = img.Height;

                        this._bgOriginalImage = img;

                        this.bgFileLbl.Text = Path.GetFileName(ofd.FileName);

                        this.InitialBGImage();
                    }
                }
            }
        }