Advertisement
jhei13

IMAGE PROCESSING AND NEURAL NETWORK VERSION1

Nov 12th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Image_Browser_ImaPro
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
  20.         {
  21.             OpenFileDialog openFileDialog1 = new OpenFileDialog();
  22.             openFileDialog1.ShowDialog();
  23.             //private System.Windows.Forms.OpenFileDialog openFileDialog1;
  24.             //this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
  25.         }
  26.         private void BrowseButton_Click(object sender, EventArgs e)
  27.         {
  28.  
  29.             OpenFileDialog openFileDialog1 = new OpenFileDialog();
  30.  
  31.  
  32.  
  33.             openFileDialog1.InitialDirectory = @"E:\";
  34.  
  35.             openFileDialog1.Title = "Sample Pictures";
  36.  
  37.  
  38.  
  39.             //openFileDialog1.CheckFileExists = true;
  40.             //openFileDialog1.CheckPathExists = true;
  41.             //openFileDialog1.DefaultExt = "jpg";
  42.  
  43.  
  44.  
  45.             openFileDialog1.Filter = "Picture Files (*.jpg)|*.jpg";
  46.             //|All files (*.*)|*.*";
  47.  
  48.             openFileDialog1.FilterIndex = 2;
  49.  
  50.             openFileDialog1.RestoreDirectory = true;
  51.  
  52.  
  53.  
  54.             openFileDialog1.ReadOnlyChecked = true;
  55.  
  56.             openFileDialog1.ShowReadOnly = true;
  57.  
  58.  
  59.  
  60.             if (openFileDialog1.ShowDialog() == DialogResult.OK)
  61.             {
  62.                 //    string[] images = openFileDialog1.FileNames;
  63.                 //    foreach (string x in images)
  64.                 //    {
  65.                 //        comboBox1.Items.Add(x);
  66.                 //    }
  67.                 comboBox1.Text = openFileDialog1.FileName;
  68.                 picimage.Image = Image.FromFile(openFileDialog1.FileName);
  69.             }
  70.         }
  71.         private void btnBrowseMultiple_Click(object sender, EventArgs e)
  72.         {
  73.             OpenFileDialog openFileDialog1 = new OpenFileDialog();
  74.             openFileDialog1.Multiselect = true;
  75.  
  76.             openFileDialog1.InitialDirectory = @"D:\";
  77.  
  78.             openFileDialog1.Title = "Sample Pictures";
  79.  
  80.  
  81.  
  82.             //openFileDialog1.CheckFileExists = true;
  83.             //openFileDialog1.CheckPathExists = true;
  84.             //openFileDialog1.DefaultExt = "jpg";
  85.  
  86.  
  87.  
  88.             openFileDialog1.Filter = "Picture Files (*.jpg)|*.jpg";
  89.                 //|All files (*.*)|*.*";
  90.  
  91.             openFileDialog1.FilterIndex = 2;
  92.  
  93.             openFileDialog1.RestoreDirectory = true;
  94.  
  95.  
  96.  
  97.             openFileDialog1.ReadOnlyChecked = true;
  98.  
  99.             openFileDialog1.ShowReadOnly = true;
  100.  
  101.  
  102.  
  103.             if (openFileDialog1.ShowDialog() == DialogResult.OK)
  104.             {
  105.                 comboBox1.Items.Clear();
  106.                 string[] images = openFileDialog1.FileNames;
  107.                 foreach (string x in images)
  108.                 {
  109.                     comboBox1.Items.Add(x);
  110.                     picimage.Image = Image.FromFile(openFileDialog1.FileName);
  111.                 }
  112.                
  113.             }
  114.         }
  115.  
  116.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  117.         {
  118.  
  119.             picimage.Image = Image.FromFile(comboBox1.Text);
  120.         }
  121.     }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement