Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Resource Editor (RESEDITOR)

.NET Framework 1.1

The Resource Editor (ResEditor) sample application is also a useful tool. It provides a graphical interface that allows you to construct .resources files containing bitmaps, icons, and strings. The following figure shows using ResEditor to construct a resources file containing both strings and images:

This program consists of two source-code files: ResEditor.cs and ResHolder.cs. ResEditor.cs handles the control of the program, the reading and writing of .resources and .resx files, and the Windows Forms user interface. ResHolder.cs implements a class that holds resources and inherits from ICustomTypeDescriptor, which means that resources can be conveniently loaded into a property window for browsing and editing. The following code shows how to do this:

private void ReadResXFile(string fileName) {
    ResXResourceReader rrdr = null ; 
    try {
        rrdr = new ResXResourceReader(fileName);
        currentResHolder = new ResHolder(rrdr);
        propertyGridResources.SelectedObject = currentResHolder;
    }
    finally {
        if (null != rrdr) rrdr.Close();
    }
}
Show:
© 2015 Microsoft