【发布时间】:2011-01-05 08:35:53
【问题描述】:
我有这个代码,我怎样才能让它接受所有典型的图像格式? 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,但其他类型呢?
【问题讨论】:
标签: c# winforms openfiledialog