How to change language at runtime without layout troubles

后端 未结 2 1649
旧巷少年郎
旧巷少年郎 2021-02-20 09:35

I have a winforms application that the users must be able to change the language at runtime.

To generalize the switch and avoid having to hard code control names I tried

2条回答
  •  甜味超标
    2021-02-20 10:06

    Look at the .resx file to see what all is getting reassigned. Properties like Size and Form.AutoScaleDimensions are localizable properties. Reassigning them has the kind of effect you are seeing. Especially undoing the auto-scaling would be quite unpleasant.

    No specific advise to fix this problem, this just isn't made to be run in any other place than the form constructor. Reconstruct the form. Pointing out that the actual user of your form never feels a need to change her native language on-the-fly never seems to make an impression.

提交回复
热议问题