Page 171 - DCAP408_WEB_PROGRAMMING
P. 171
Unit 10: Menus
System.Drawing, Version=2.0.0.0, Notes
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
You can write directly to these files at run time using the ResXResourceWriter object in the
System.Resources namespace, even adding the actual binary information in a value XML element.
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAADtTeX…
</value>
ResXResourceReader, in turn, will read .resx files.
Because they're just text XML files, a .resx file can't be used directly by a .NET Framework
application. It has to be converted to a binary ".resources" file adding it to your application. This
job is accomplished by a utility program named Resgen.exe. You might want to do this to create
the satellite assemblies for the globalization mentioned earlier. It can also convert binary
.resources files back into XML .resx files but only string resources get converted correctly.
And DOS will never die! You have to run resgen.exe from a Command Prompt.
VB6 supports
A string table editor
(“Edit String Tables...”)
Custom cursors - “CUR” files
(“Add Cursor...”)
Custom icons - “ICO” files
(“Add Icon...”)
Custom bitmaps - “BMP” files
(“Add Bitmap...”)
Programmer defined resources
(“Add Custom Resource...”)
VB 6 provides a simple editor for strings but you have to have a file created in another tool for
all of the other choices.
Example: You could create a BMP file using the simple Windows Paint program.
Each resource in the resource file is identified to VB 6 by an Id and a name in the Resource Editor.
To make a resource available to your program, you add them in the Resource Editor then use the
Id and the resource “Type” to point to them in your program. Let’s add four icons to the resource
file and use them in the program. When you add a resource, the actual file itself is copied into
your project. Visual Studio 6 provides a whole collection of icons in the folder ...
C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons
To go with tradition, we’ll select the Greek philosopher Aristotle’s four “elements” - Earth,
Water, Air, and Fire - from the Elements subdirectory. When you add them, the Id is assigned by
Visual Studio (101, 102, 103, and 104) automatically.
LOVELY PROFESSIONAL UNIVERSITY 165