I have this code, how can I allow it to accept all typical image formats? PNG, JPEG, JPG, GIF?
Here's what I have so far:
public void EncryptFile()
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
dialog.InitialDirectory = @"C:\";
dialog.Title = "Please select an image file to encrypt.";
if (dialog.ShowDialog() == DialogResult.OK)
{
//Encrypt the selected file. I'll do this later. :)
}
}
Notice that the filter is set to .txt files. I could change to PNG, but what of the other types?
Thanks SO!
Edit:
I figure it out, this is how you do it:
dialog.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif";