开发者

How to automatically resize controls based on the language associated .resx info?

I got some legacy .net code and modified the application so it can be multilanguage.

I've set the Form's Localizable propriety to True and created a Language and made the necessary modifications with the designer for each language.

I can easily update all the control's text 开发者_开发问答to the correct language, but I can't figure out how to redraw the main Window with all its tablelayouts.

Basically, for each language, in the associated .resx, at "Others", I have the sizes I want it to be redrawn/refreshed to:

$this.ClientSize System.Drawing.Size 815, 700

cmdCloseForm.Location   System.Drawing.Point    781, 6

cmdMinimize.Location    System.Drawing.Point    757, 6

pictureBoxBanner.Size   System.Drawing.Size 807, 90

tableLayoutPanel1.Size  System.Drawing.Size 204, 530

tableLayoutPanel2.Size  System.Drawing.Size 807, 90

tableLayoutPanel4.Location  System.Drawing.Point    212, 125

tableLayoutPanelAbout.Location  System.Drawing.Point    212, 125
[...]

How can I resize all of these, because there must be a way to automatically do it(the designer is capable of resizing everything, if the language is changed, for example..), given the fact that they are stored in the resx.. I've tried refreshing the main Form, freezing it and refreshing it.. to no avail. How can I make the program aware of the fact that, if the language is changed, to automatically resize/move all the controls in the language .resx to the sizes specified there?


It could be difficult to retrofit to a legacy app, but Microsoft recommend using TableLayout, AutoSize and Anchor in Walkthrough: Creating a Layout That Adjusts Proportion for Localization

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜