我从事windows应用程序的工作。它在应用程序中有一个在check box list中显示check boxes的表单,这里是表单的屏幕截图

这是我的应用程序的单一形式,我以不同的语言显示,我的windows应用程序也是以多种语言制作的,如英语,德语,日语等。
我的问题是how to display translated text of check box in check box list
下面是我的代码:
this.checkedListBox1.FormattingEnabled = true;
this.checkedListBox1.Items.AddRange(new object[] {
"Select All",
"Amplitude1",
"Amplitude2",
"Amplitude3",
"Amplitude4",
"Amplitude5",
"Amplitude6",
"Amplitude7"});
this.checkedListBox1.Location = new System.Drawing.Point(96, 55);
this.checkedListBox1.Name = "checkedListBox1";
this.checkedListBox1.Size = new System.Drawing.Size(123, 124);
this.checkedListBox1.TabIndex = 8;
this.checkedListBox1.SelectedIndexChanged += new System.EventHandler(this.ckbselectall_CheckedChanged);我制作了一个单独的文件来翻译表单的文本,我把代码放在LCheckBox是我的文件的地方,我从那里翻译复选框列表中的文本
this.checkedListBox1.FormattingEnabled = true;
this.checkedListBox1.Items.AddRange(new object[] {
LCheckBox.SELECTALL,
LCheckBox.Amplitude1,
LCheckBox.Amplitude2,
LCheckBox.Amplitude3,
LCheckBox.Amplitude4,
LCheckBox.Amplitude5,
LCheckBox.Amplitude6,
LCheckBox.Amplitude7});
this.checkedListBox1.Location = new System.Drawing.Point(96, 55);
this.checkedListBox1.Name = "checkedListBox1";
this.checkedListBox1.Size = new System.Drawing.Size(123, 124);
this.checkedListBox1.TabIndex = 8;
this.checkedListBox1.SelectedIndexChanged += new System.EventHandler(this.ckbselectall_CheckedChanged);但是它给了我一些错误信息
发布于 2012-08-16 15:09:31
您可以在开始时询问语言,然后根据语言创建复选框列表。对于每种语言,可以使用不同的if大小写。
发布于 2012-08-16 15:47:36
在代码中,我只使用items集合来修改所需的项。
假设你有一个带有按钮的表单。当单击按钮时,您希望向列表中的所有项添加一个项,然后执行此操作的代码将如下所示:假设列表框的名称为"_list“,按钮的名称为”_button“。
private void FillList()
{
_list.BeginUpdate();
_list.Items.Clear();
for(int i =0 ; i <=9; i++)
_list.Items.Add(i);
_list.EndUpdate();
}
private void _button_Click(object sender, System.EventArgs e)
{
_list.BeginUpdate();
ListBox.ObjectCollection items = _list.Items;
int count = items.Count;
for(int i = 0; i < count; i++)
{
int integerListItem = (int)items[i];
integerListItem ++;
// --- Update The Item
items[i] = integerListItem;
}
_list.EndUpdate();
}https://stackoverflow.com/questions/11982200
复制相似问题