开发者

.NET WinForms: Localization in the inherited form

I have a base form with several controls including 1 label. This form is localized in several languages.

I have another for开发者_StackOverflowm which is inherited from the base one. I'd like to have another localization strings for that label, but I can't change label text, all properties are disabled even in case of public modifiers..

Can anyone tell me how to apply another texts for that label using the designer?

Thanks in advance..


As far is i know that's not possible using just the designer. (Would be cool if someone proved me wrong tough). But you can always do it manually using code.

First you'd set the modifier of the label to protected or public so you can access it from your inherited control.

Next you open the resx file in designer mode and add a string to it using an alias that you get to choose.

Finally you can manually create a resource manager for the form and use it to set the text for the label

ComponentResourceManager resources = new ComponentResourceManager(typeof(Form2));
label1.Text = resources.GetString("<alias for the control>");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜