如何在WinForms的自定义控件中本地化字符串?
我有一个自定义向导控件,我正在修改一个标题和一个子标题。如何在控件中保存和本地化字符串?这里是字幕属性:如何在WinForms的自定义控件中本地化字符串?
[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);
}
}
}
回答:
只需添加本地化属性
[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);
}
}
}
以上是 如何在WinForms的自定义控件中本地化字符串? 的全部内容, 来源链接: utcz.com/qa/263731.html