ImageLists on localized forms

  • Thread starter Thread starter Gerrit
  • Start date Start date
G

Gerrit

Hi.

When setting Form.Localizable = True in Visual Studio, any ImageList on the
form is copied/serialized into the resources for each language. This
behavior is really annoying, since I only want to have _one_ copy of the
icons (the same icons for all languages). Right now I have to either
manually update the icons for each language or remove the serialized
ImageList from the resx files. Another problem is that the application is
getting "bloated" because of the multiple copies of the same icons. Is there
any way to avoid this behavior? I already have implemented a customized
LocalizationFilter (
http://windowsforms.net/articles/localizationfilter.aspx ), but the Windows
Forms designer seems to ignore it when checking if the ImageLists should be
serialized.


Regards,

Gerrit
 
Hi Gerrit,

Based on my understanding, you want to eliminate the imagelist to be store
in several language resources.

I think the article in your reply should meet your need. I have tried the
source code of that article, if I added an imageList to the FilteredForm,
then add other languages resource, the ImageStream resource of imagelist
will not be stored in the added resource file. So the filter takes effect.

Anway if you still have any question on this issue, please feel free to
tell me. I will work with you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Jeffrey.

I just tried again with the sample application of the article. I added an
ImageList, added some icons to the ImageList and then assigned the icons to
the tab pages. Then I switched the language in the form designer to Spanish
and changed some text. After saving the form, the file
"FilteredForm.es.resx" is automatically created and contains the
ImageStream.

I can manually remove the ImageStream from the RESX file (and the program
works fine), but as soon as I save the form from within Visual Studio 2003
the ImageStream is added again to the localized RESX file.

Thanks,

Gerrit
 
Hi Gerrit,

Thanks very much for your feedback!

Oh, yes, it seems that if we used the ImageList's picture, the ImageStream
will be persisted in other resource file. For this issue, I will spend more
time on it. I will update you ASAP. Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Gerrit,

I have contacted the author of that article Brian Pepin. We are currently
discussion on this issue. I will reply to you ASAP. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Gerrit,

Sorry for letting you wait for so long.

After discussing with Brian, I got some useful information for this issue.

In VS.net, the code generator can save a property in one of three ways:
1. As code
2. As a resource in the current language¡¯s resx file.
3.As a design time property resource in the default resx file.

Localization is simply a process where the code generator moves properties
that are normally saved as code(#1) into the current language¡¯s resx file.
However, some properties (even those that are not marked as
localizable)(just like ImageList.ImageStream property) cannot be stored in
code and are therefore always saved as a resource.

Note that except for design time properties, the code generator never
touches the default resource file; it always writes to the current language¡
¯s resx file. This is why the images for the image list are always stored
in the current language¡¯s resx file even if the property is marked as
non-localizable.

So currently, there is no way to restrict the images to be stored in
default resx file. Also, I was told that in Whidbey, it will support
application-level image resources in the designer, and the whole story for
resource serialization will change.

Hope this information makes sense to you.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Jeffrey.

Thanks for the information, it certainly makes sense. I guess I'll have to
switch to Whidbey rather sooner than later... ;)


Kind regards,

Gerrit
 
You are welcome! I am glad my work makes sense to you, if you need further
help, please feel free to post, I will work with you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top