osman
osman

Reputation: 63

How to create a custom file type in c# with a custom icon?

I need the path of x.gdb(.gdb file type) . Which is a folder and contains different type of file. I want to give a custom icon of .gdb folders.

Project Open Window

When a user click the browse button prompts the OpenFileDialog. User select a .gdb folder, the .gdb folder name will show in filename textbox of OpenFileDialog. User click on open button the filepath will show in Project Open Window textbox. If user double click on .gdb file filepath will show in Project Open Window textbox. How can i do this?

Upvotes: 3

Views: 2537

Answers (1)

Ryan
Ryan

Reputation: 113

If you want to see your custom file icon in windows explorer and OpenFileDialog you should set an icon for your file extension in windows registry, Here is a simple .REG file that registers an icon for the file extension .gdb

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.gdb]

[HKEY_CLASSES_ROOT\.gdb\DefaultIcon]
@="D:\\icons\\gdb.ico"

For more information about how to register icon for a file type:

https://msdn.microsoft.com/en-us/library/windows/desktop/hh127427(v=vs.85).aspx

https://www.codeproject.com/Articles/29137/Get-Registered-File-Types-and-Their-Associated-Ico

Upvotes: 2

Related Questions