Пример #1
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     if (_ImageMap != null && ImageFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         _ImageMap.Save(ImageFileDialog.FileName, ImageFormat.Png);
     }
 }
Пример #2
0
        private void UploadFiles()
        {
            ImageFileDialog.Filter = "图片文件|*.bmp;*.png;*.jpg;*gif"; //显示所有图片文件
            if (ImageFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _imagesUploaded = new List <Image>();
            foreach (var fileName in ImageFileDialog.FileNames)
            {
                _imagesUploaded.Add(Image.FromFile(fileName));
            }
        }
        private void ImageSelectionButton_Click(object sender, EventArgs e)
        {
            ImageFileDialog.Filter = "BMP|*.bmp|GIF|*.gif|JPG|*.jpg;*.jpeg|PNG|*.png|TIFF|*.tif;*.tiff|"
                                     + "All Graphics Types|*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff";
            ImageFileDialog.FilterIndex = 6;
            ImageFileDialog.Multiselect = false;

            ImageFileDialog.ShowDialog();

            if (ImageFileDialog.CheckFileExists && ImageFileDialog.FileName != "")
            {
                image = Image.FromFile(ImageFileDialog.FileName);
                ImagePictureBox.BackgroundImage = image;
            }
        }
Пример #4
0
        private void buttonImport_Click(object sender, EventArgs e)
        {
            if (ImageFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string imagePath = ImageFileDialog.FileName;
                try
                {
                    Bitmap mazeImage = new Bitmap(imagePath);
                    BuildMap(mazeImage);
                    picMaze.Image = mazeImage;
                }
                catch
                {
                    return;
                }

                SetMode(1);
            }
        }
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ImageFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var bmp = _processor.ConvertToGrayscale(new Bitmap(ImageFileDialog.FileName));
                    _image.OriginalImage = bmp;
                    _image.ViewImage     = bmp;

                    pictureBox1.BorderStyle = BorderStyle.FixedSingle;
                    EnableMenuBarToolstrips();
                    isBinarized = false;
                }
                catch (ArgumentException ex)
                {
                    var extension = ImageFileDialog.FileName.Split('.');
                    MessageBox.Show($"Could not open file with .{extension[extension.Length - 1]} format",
                                    "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #6
0
 private void ImagePathButton_Click(object sender, EventArgs e)
 {
     ImageFileDialog.ShowDialog(this);
     ImageTextBox.Text = ImageFileDialog.FileName;
 }