Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Image_Browser_ImaPro
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
- {
- OpenFileDialog openFileDialog1 = new OpenFileDialog();
- openFileDialog1.ShowDialog();
- //private System.Windows.Forms.OpenFileDialog openFileDialog1;
- //this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- }
- private void BrowseButton_Click(object sender, EventArgs e)
- {
- OpenFileDialog openFileDialog1 = new OpenFileDialog();
- openFileDialog1.InitialDirectory = @"E:\";
- openFileDialog1.Title = "Sample Pictures";
- //openFileDialog1.CheckFileExists = true;
- //openFileDialog1.CheckPathExists = true;
- //openFileDialog1.DefaultExt = "jpg";
- openFileDialog1.Filter = "Picture Files (*.jpg)|*.jpg";
- //|All files (*.*)|*.*";
- openFileDialog1.FilterIndex = 2;
- openFileDialog1.RestoreDirectory = true;
- openFileDialog1.ReadOnlyChecked = true;
- openFileDialog1.ShowReadOnly = true;
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- // string[] images = openFileDialog1.FileNames;
- // foreach (string x in images)
- // {
- // comboBox1.Items.Add(x);
- // }
- comboBox1.Text = openFileDialog1.FileName;
- picimage.Image = Image.FromFile(openFileDialog1.FileName);
- }
- }
- private void btnBrowseMultiple_Click(object sender, EventArgs e)
- {
- OpenFileDialog openFileDialog1 = new OpenFileDialog();
- openFileDialog1.Multiselect = true;
- openFileDialog1.InitialDirectory = @"D:\";
- openFileDialog1.Title = "Sample Pictures";
- //openFileDialog1.CheckFileExists = true;
- //openFileDialog1.CheckPathExists = true;
- //openFileDialog1.DefaultExt = "jpg";
- openFileDialog1.Filter = "Picture Files (*.jpg)|*.jpg";
- //|All files (*.*)|*.*";
- openFileDialog1.FilterIndex = 2;
- openFileDialog1.RestoreDirectory = true;
- openFileDialog1.ReadOnlyChecked = true;
- openFileDialog1.ShowReadOnly = true;
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- comboBox1.Items.Clear();
- string[] images = openFileDialog1.FileNames;
- foreach (string x in images)
- {
- comboBox1.Items.Add(x);
- picimage.Image = Image.FromFile(openFileDialog1.FileName);
- }
- }
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- picimage.Image = Image.FromFile(comboBox1.Text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement