最佳答案
我有这个代码,我怎么能让它接受所有典型的图像格式?Png, jpeg, jpg, gif ?
以下是我目前所了解到的:
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. :)
}
}
注意,过滤器被设置为.txt文件。我可以更改为PNG,但其他类型呢?