Exemplo n.º 1
0
 public void Open()
 {
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Filter = "JPG|*.jpg;*.jpeg|BMP|*.bmp|GIF|*.gif|PNG|*.png|TIFF|*.tif;*.tiff";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         loadedImage = new LoadedImage(openFileDialog.FileName);
         updateImage(loadedImage);
     }
 }
Exemplo n.º 2
0
        public void updateImage(LoadedImage img)
        {
            switch (sizeMode.Text.ToLower())
            {
                case "autosize":
                    imageFrame.SizeMode = PictureBoxSizeMode.AutoSize;
                    break;
                case "normal":
                    imageFrame.SizeMode = PictureBoxSizeMode.Normal;
                    break;
                case "zoom":
                    imageFrame.SizeMode = PictureBoxSizeMode.Zoom;
                    break;
                case "centerimage":
                    imageFrame.SizeMode = PictureBoxSizeMode.CenterImage;
                    break;
                case "strechimage":
                    imageFrame.SizeMode = PictureBoxSizeMode.StretchImage;
                    break;
            }

            if (loadedImage != null)
            {
                imageFrame.Image = loadedImage.currentImage;
            }

            imageFrame.Invalidate();
        }