PropertyEditor 本地化问题
-
24-09-2019 - |
题
我在 .NET 3.5 应用程序中使用 PropertyEditor 来允许用户编辑某些序列化类中包含的设置。该应用程序需要本地化才能支持多种语言。使用标准 .NET 资源实现的本地化字符串。
PropertyEditor 需要通过属性设置类别、显示名称和描述。下面的例子:
[CategoryAttribute("Some category"),
DisplayNameAttribute("Some name"),
DescriptionAttribute("Some description"),
EditorAttribute(typeof(SomeEditor), typeof(System.Drawing.Design.UITypeEditor))]
public SomeType SomeValue {get; set;}
但编译器不允许我在属性值中使用资源字符串,更改第一行如下:
[CategoryAttribute(Resources.labels.SomeCategory),
产生错误:“分配给‘App.Settings.SomeCategory’的表达式必须是常量。”
谁能帮助我如何在 WinForms 中正确本地化属性编辑器?
不隶属于 StackOverflow