我有一个自定义向导控件,正在使用“标题”和“子标题”进行修改。如何在控件中保存和本地化字符串?这是SubTitle属性:
[Category("Appearance"), DefaultValue("Description for the new page."), Description("The subtitle of the page."), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
public string Subtitle
{
get { return subtitle; }
set
{
if (subtitle != value)
{
Region regionToInvalidate = GetTextRegionToInvalidate();
subtitle = value;
regionToInvalidate.Union(GetTextRegionToInvalidate());
Invalidate(regionToInvalidate);
}
}
}
最佳答案
只需添加Localizable属性
[Category("Appearance"), DefaultValue("Description for the new page."), Description("The subtitle of the page."), Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
[Localizable(true)]
public string Subtitle
{
get { return subtitle; }
set
{
if (subtitle != value)
{
Region regionToInvalidate = GetTextRegionToInvalidate();
subtitle = value;
regionToInvalidate.Union(GetTextRegionToInvalidate());
Invalidate(regionToInvalidate);
}
}
}
关于c# - 如何在WinForms中的自定义控件中本地化字符串?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9826804/