WinForms strings in resource files, wired up in designer

后端 未结 5 2051
星月不相逢
星月不相逢 2021-02-05 12:58

I\'m trying to localise a WinForms app for multiple languages. I\'m trying to find a way to set my form labels/buttons text properties to read from the resources file in the des

5条回答
  •  野的像风
    2021-02-05 13:17

    I think I found a way to do this!

    First in your Resources.resx set the Access Modifier to Public.

    After that in the designer generated code (Form.Designer.cs) you can write this to the appropriate control:

    this..Text = Properties.Resources.
    

    for example:

    this.footerLabel.Text = Properties.Resources.footerString;
    

    ps.:I don't know how ethical this solution is, but it works!

提交回复
热议问题