// user encodes the data private void EncodeButton_Click(object sender, EventArgs e) { text = WordsTextBox.Text; // if the user wants to encrypt the text if (PasswordCheckBox.Checked == true) { text = StringCipher.Encrypt(WordsTextBox.Text, PasswordTextBox.Text); } // exit if there is no bmp file or it is too small if (ValidDetails() == false) { return; } bmp = Steg.Embed(text, bmp); SaveFileDialog sfd = new SaveFileDialog(); sfd.Title = "Save Image"; sfd.DefaultExt = "png"; sfd.Filter = "Png files (*.png)|*.png"; sfd.FilterIndex = 2; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == DialogResult.OK) { bmp.Save(sfd.FileName, ImageFormat.Png); } }