private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = ".//"; openFileDialog1.Filter = "All files (*.*)|*.*"; openFileDialog1.RestoreDirectory = false; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { pic = new PicForHide(openFileDialog1.FileName); pictureBox1.Image = pic.Image; pictureBox1.Show(); } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); pic.Clear(); pictureBox1.Hide(); } richTextBox2.Text = pic.Decode(); } }
private void button_open_picture_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = ".//"; openFileDialog1.Filter = "All files (*.*)|*.*"; openFileDialog1.RestoreDirectory = false; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { pic = new PicForHide(openFileDialog1.FileName); format = Path.GetExtension(openFileDialog1.FileName); format = format.Split('.')[1]; pictureBox1.Image = pic.Image; pictureBox1.Show(); } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); pic.Clear(); pictureBox1.Hide(); } } }