As we all know, working with image resources in .NET is hard. In this particular case, when I have a .resx file in my project I find it difficult to update images, add new icons and so on because the editor associated to .resx files is XML-based. So for example when I download a project from the Web and the project has a .resx file I can't edit images easily.
Microsoft SDK v.1.1 includes a sample application called ResEditor (<program files>\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Tutorials\resourcesandlocalization\reseditor) for editing resource files, but it has some problems:
1) The main method doesn't receive parameters; therefore you cannot set it as your default editor for .resx files.
2) The dirty flag for the document is not working well. Before closing, the program always prompts to save even if you haven’t modified the document.
3) You can't edit individual items such as icons or bitmaps.
So I developed a resource editor for .resx integrated to Visual Studio using VSIPExtras and the ResEditor sample as base code. Basically, the ResEditor was built using the VSIPExtras wizard for a new package, and after that I built the editor with the refactored ResEditor sample.
- Dirty flag management
- You can edit and save an icon or bitmap with Visual Studio editor and it is updated in the resx editor!!
- If the bitmap has more than 256 colors it is edited with mspaint.
- You can edit ImageLists
Installation (Visual Studio 2003 required):
- Extract the downloaded files to a folder. (i.e.: C:\ResEditor)
- If you copy the files to a folder other than C:\ResEditor, edit regEditor.reg and replace C:\\ResEditor with you path. (Use "\\" insted of "\" i.e "c:\\Program Files\\MyPath" )
- Run regEditor.reg
- Open Visual Studio 2003 command prompts and type "devenv /setup"
- Open Visual Studio 2003.
- In the Open File dialog select a resx file and select Open With. (Dropdown in the Open button)
- Select the ResEditorEx as your resource editor (if you want set it as your default :)
I have updated this post because the links were broken. You can download the new bits and code here
- This editor depends on the primary interop assemblies of VSIPExtras. VSIPExtras is not released yet so the primary interop assemblies may change in the next beta or release version.
Improvements to the code are welcome. For instance, I’d like to enhance the editor with undo&redo support, support for edit new types, ...