Пример #1
0
 private void pbxImage_Paint(object sender, PaintEventArgs e)
 {
     if (pbxImage.Image != null)
     {
         imgBorderHelper = new BorderHelper(currentImage.GetRectangle(), mouseError);
         if (currentImage.HasCrop)
         {
             Graphics graphics = e.Graphics;
             graphics.DrawRectangle(pen, currentImage.Crop.GetRectangle());
             cropBorderHelper = new BorderHelper(currentImage.Crop.GetRectangle(), mouseError);
         }
     }
 }
Пример #2
0
        private void btnSelectBoundary_Click(object sender, EventArgs e)
        {
            txtBoundHeight.Enabled = true;
            txtBoundWidth.Enabled = true;
            txtBoundHeight.Text = currentProfile.Height.ToString();
            txtBoundWidth.Text = currentProfile.Width.ToString();
            btnSetBounds.Enabled = true;
            btnCropColor.Enabled = true;
            currentImage.RemoveCrop();

            if (currentImage.AddCrop(new Size { Height = currentProfile.Height, Width = currentProfile.Width }))
            {
                pbxImage.Invalidate();
                cropBorderHelper = new BorderHelper(currentImage.Crop.GetRectangle(), mouseError);
                btnCrop.Enabled = true;
            }
            else
                MessageBox.Show("Crop bounds must be smaller than image bounds.");
        }
Пример #3
0
        private void OpenImage()
        {
            using (OpenFileDialog dlgGetImage = new OpenFileDialog())
            {
                dlgGetImage.InitialDirectory = currentProfile.ImageDirectory;
                dlgGetImage.Filter = "All Files(*.*)|*.*|JPEG Files (*.jpg)|*.jpg|PNG Files (*.png)|*.png";

                if (dlgGetImage.ShowDialog() == DialogResult.OK)
                {
                    Bitmap bitmap = new Bitmap(dlgGetImage.FileName);
                    string imgName = dlgGetImage.SafeFileName;
                    string imgFullPath = dlgGetImage.FileName;
                    currentImage = new EditorImage(bitmap, imgName, imgFullPath, bitmap.GetImageFormat());
                    imgBorderHelper = new BorderHelper(currentImage.GetRectangle(), mouseError);
                    txtCurrentImg.Text = currentImage.ImgName;
                    txtImgHeight.Text = currentImage.StartImg.Height.ToString();
                    txtImgWidth.Text = currentImage.StartImg.Width.ToString();
                    btnSelectBoundary.Enabled = true;
                    nudImageSize.Enabled = true;
                    nudImageSize.Value = 0;
                    pbxImage.Image = currentImage.StartImg;
                }
            }
        }
Пример #4
0
 /*
  * Button Event Handlers
  * */
 private void btnOpenImage_Click(object sender, EventArgs e)
 {
     OpenImage();
     if (currentImage != null)
         imgBorderHelper = new BorderHelper(currentImage.GetRectangle(), mouseError);
 }