localizing bitmaps
-
Hi, I'm currently trying to localize a .Net project. that means I need to use localized resources like stringtables and Bitmaps for german and english. Following a localization sample delivered by VS, I succeessfully localized string-resources using the resgen and afterwards the assemblylinker(al.exe) tools. Unfortunately, using the al-tool to localize bitmaps failed. Does anyone have ideas or examples with which parameters to call the al.exe to use localized Bitmaps and how to use the bitmap-resource via GetManifestResourceStream() or something? Thanks, klawipo
-
Hi, I'm currently trying to localize a .Net project. that means I need to use localized resources like stringtables and Bitmaps for german and english. Following a localization sample delivered by VS, I succeessfully localized string-resources using the resgen and afterwards the assemblylinker(al.exe) tools. Unfortunately, using the al-tool to localize bitmaps failed. Does anyone have ideas or examples with which parameters to call the al.exe to use localized Bitmaps and how to use the bitmap-resource via GetManifestResourceStream() or something? Thanks, klawipo
The easiest way is to persist the images in ResX files (typically encoded in base64 - just set a
BackgroundImage
for a control and look at the form's/user control's .resx file "under" the file is you show all files in your project for an example). This allows you to use theResourceManager
which already takes care of the satellite assemblies for you; otherwise, you can useAssembly.GetSatelliteAssembly
(calling it on anAssembly
reference that is the primary assembly using the same assembly name but a different culture) and then callGetManifestResourceStream
from that. If your primary assembly (the one with IL modules in it - the code that is executing) contains that culture (if you use the assembly-levelNeutralResourcesLanguageAttribute
) or if no satellite assembly is found, and exception will be thrown so then grab the resource out of the primary assembly.Microsoft MVP, Visual C# My Articles