Setting the filter to an OpenFileDialog to allow the typical image formats?

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() … Read more

How do you configure an OpenFileDialog to select folders?

In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I’ve seen this I’ve wanted to know how it’s done. I am aware of the FolderBrowserDialog, but I’ve never really liked that … Read more

How do I use OpenFileDialog to select a folder?

I was going to use the following project: https://github.com/scottwis/OpenFileOrFolderDialog However, there’s a problem: it uses the GetOpenFileName function and OPENFILENAME structure. OPENFILENAME has the member named templateID, which is the identifier for dialog template. And the project contains the res1.rc file and the templated dialog init, too. But I couldn’t figure out how to attach … Read more