3

因此,我正在尝试本地化/翻译现有应用程序,此代码在基本表单上运行,并且一切都按预期工作,直到它遇到 BrightIdeasSoftware.ObjectListView (它正确地迭代子项目等)问题是在 ObjectListView 上的列应该有一个 Name 集,但它始终为空。

ComponentResourceManager parentManager = new ComponentResourceManager(this.GetType());
CultureInfo language = new CultureInfo("en");
foreach (Control subControl in this.Controls) {
    parentManager.ApplyResources(subControl, subControl.Name, language);
}

当它遇到 ObjectListView 时:

ObjectListView localControl = (ObjectListView)subControl;
foreach (OLVColumn column in localControl.Columns)
{
    parentManager.ApplyResources(column, column.Name/*This is the issue*/, language);
}

当我在设计器代码中设置列的名称时,它确实按预期工作,并且在更改后它实际上确实再次正确生成名称代码,但我无法通过整个项目将名称属性添加到所有 objectListViews时间一被添加到项目中。

我尝试寻找包含 Name 值的任何属性,但找不到任何属性(它显示在设计器 GUI 中)。

我尝试在 OLV 支持论坛中搜索解决方案,但找不到解决方案,并注意到很多遇到 OLV 问题的人在这里得到了一些帮助,所以我想我会先在这里寻求帮助。

非常感谢任何帮助,在此先感谢!

4

1 回答 1

1

它没有自动添加“名称”

this.olvColSetPartName.AspectName = "Name";
resources.ApplyResources(this.olvColSetPartName, "olvColSetPartName");

给它一个“名字”

this.olvColSetPartName.Name = "olvColSetPartName";
于 2017-08-23T08:13:07.490 回答