예제 #1
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;
                }
            }
        }
예제 #2
0
 /*
  * Methods
  * */
 private void ChangeSize(decimal amount, 
                         EditorImage.ResizeTypes type, 
                         EditorImage.ResizeDirections dir)
 {
     decimal newNudSizeVal;
     if (currentImage.ChangeSize(amount, type, dir, out newNudSizeVal))
     {
         txtImgHeight.Text = currentImage.AlteredImg.Height.ToString();
         txtImgWidth.Text = currentImage.AlteredImg.Width.ToString();
         btnRollBack.Enabled = true;
         btnSave.Enabled = true;
         nudImageSize.Value = newNudSizeVal;
         pbxImage.Image = currentImage.AlteredImg;
     }
 }