c# winform inheritance and localization

G

Gardner

I am having some problems with localizing my project to support
multiple languages. It got really messy, and finally I created a small
sample project that clerifies the problem's source, but I still don't
know what I am doing wrong -
I create a simple form (form1) with a button (button1). I set the
form's font to Arial, 10pt, and the button to protected (I need it in
my real project, I am not sure it has anything to do with the actual
problem).
Then I create form2, which inherits form1, and adds button2. I make
button1 open form2, and vice-versa, so I can check both forms at run
time. Everything works smoothly.
Now I set both forms to localizable = true. I also add to both another
language (I add Hebrew, but I am not sure it matters), and I change the
forms' and buttons' text properties so I can see the difference in
runtime as well.
Here is where the problem starts - when I now rebuild my project,
form2's font changes to Microsoft Sans Sarif.
When I tried it in VS2005, I saw in the form2.Designer.cs file those
two lines:

this.font = null;
this.icon = null;

and at run time, and also when the designer renders the form, it
switches to the default font of Microsoft Sans Sarif (I also need the
icon in my real project, so that's another problem, originating from
the same place, I suspect). This font change also causes the form to
resize, and the buttons to resize and move - in a more complicated form
it messes up the whole layout. again, on VS2005, I can set the form's
AutoScale property to false, and then the form remains in it's original
size and layout.
In VS2003, setting the AutoScale to false doesn't help, and the form is
messed up anyway. Also, in VS2003 I don't see the above "null" lines,
but the created .resx file contains null entries for font and icon.

Why are those two lines pop up? Is there anything I am missing here?
Has anyone else encountered such a problem?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top