views:

53

answers:

1

I have the same UI code running on my XP English machine and on XP Japanese machine. For some reason - the behavior is different between those two machines:

On the Japanese machine the OnResize event is getting triggered during the InitializeComponent call (I think that from ResumeLayout function). On the English machine it doesn't.

I have an override method of OnResize that change values of my private variables that I defined. Since the component was not fully loaded (the Ctor is still running), those variables are null and I get an exception.

I can fix the code by checking if the variable is null or not, but I would like to understand why it is getting called in the first place and why it happens only on this machine.

During my search over the net I found the same problem that someone else has posted, but with no solution (http://social.msdn.microsoft.com/Forums/en/winforms/thread/95aefae4-45d8-4ac5-a8f2-6e2142dfb631).

A: 

Proper disclosure: I am working with Hila so I was able to see the code. The reason for the different behaviour was due to the a property of the control called AutoScaleMode. In the base class of the control the value of this property was AutoScaleMode.Font. Since all our R&D machines are running with the same settings (English) they behaved properly and the bug didn't happen there. Changing to a Japanese machine meant different font settings from the ones on the English machines. This caused the trouble. So we changed the value of the AutoScaleMode property to None and it solved the issue. Conclusion: beware of the AutoScaleMode property.

Ikaso