读书人

动态改变 ListView 下提示信息怎么弄

发布时间: 2013-01-01 14:04:18 作者: rapoo

动态改变 ListView 上提示信息,如何弄?
想在界面上,加一个 checkBox,默认时,ListView 上提示如下所示

当选中checkBox时, 提示修改

h3.Width = 290;
h3.Text = "PC + EPC + CRC";


也就是,把第三列上的提示修改为:“PC + EPC + CRC”


ColumnHeader h1 = new ColumnHeader();
h1.Width = 45;
h1.Text = "No.";
ColumnHeader h2 = new ColumnHeader();
h2.Width = 60;
h2.Text = "Len";
ColumnHeader h3 = new ColumnHeader();
h3.Width = 290;
h3.Text = "EPC";
h4.Width = 65;
h4.Text = "Times";


listView1.Columns.Add(h1);
listView1.Columns.Add(h2);
listView1.Columns.Add(h3);
listView1.Columns.Add(h4);

listView1.View = View.Details;
listView1.GridLines = true;
listView1.FullRowSelect = true;






还有一种也行:

就是把 PC 和 CRC ,,这个两个提示,也弄成 一列,就是把原来的4列,变成6列提示

这个又该如何弄?
谢谢

[解决办法]
引用:
引用:checkbox被选中就触发事件 将第3列改为你要的样子

好像不行呀

C# code?123456789101112131415161718192021 ColumnHeader h1 = new ColumnHeader(); h1.Width = 45; h……


把列的添加和设置改为全局的,等checkbox被选中时候把列名改成你想要的就行了

读书人网 >C#

热点推荐