listView的简单问题,急!。。。。。。。。。。。。。。。。。

lanye_purple 2007-01-31 02:41:59
this.listView1.Items.Add("123");
this.listView1.Items.Add("456");
this.listView1.Items.Add("789");
this.listView1.View = View.List;
this.listView1.CheckBoxes = true;
这样,可以得到如下结果:"口"表示checkBox选择框
口123
口456
口789
现我想在123前面加一个没有checkBox框的组头,如下:

一等奖号码
口123
口456
口789

这个"一等奖号码"如何添加到listView中去。
...全文
289 13 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
lanye_purple 2007-02-01
  • 打赏
  • 举报
回复
Group好像是 vs2005裡面才有吧。我剛在網上找了一下。
lanye_purple 2007-02-01
  • 打赏
  • 举报
回复
Group这个属性我这边怎么 没有呢。。

我是vs2003 win下面。
jintao0405 2007-02-01
  • 打赏
  • 举报
回复
Label labe=new Label();
labe.Text="一等奖";
labe.Height=16;
this.listView1.Controls.Add(labe);
this.listView1.Items.Add(" ");
this.listView1.Items.Add("123");
this.listView1.Items.Add("456");
this.listView1.Items.Add("789");
this.listView1.View = View.List;
this.listView1.CheckBoxes = true;

这个办法奇差,但是没找到其他办法了
xiaoliangwh 2007-02-01
  • 打赏
  • 举报
回复
帮顶了!
QQ576006 2007-02-01
  • 打赏
  • 举报
回复
yes,Group是VS2005所带的新特性
王集鹄 2007-01-31
  • 打赏
  • 举报
回复
同意楼上,用Group实现更合适
he_8134 2007-01-31
  • 打赏
  • 举报
回复
listView1.Columns.Add("获奖名单",200);
listView1.Groups.Add("一等奖", "一等奖");
listView1.Groups.Add("二等奖", "二等奖");
listView1.Groups["一等奖"].Items.Add(new ListViewItem("小张"));
listView1.Groups["一等奖"].Items.Add(new ListViewItem("小李"));
listView1.Groups["二等奖"].Items.Add(new ListViewItem("小王"));
listView1.Groups["二等奖"].Items.Add(new ListViewItem("小孟"));
for (int i = 0; i < listView1.Groups.Count; i++)
{
for (int j = 0; j < listView1.Groups[i].Items.Count; j++)
{
listView1.Items.Add(listView1.Groups[i].Items[j]);
}
}
listView1.ShowGroups = true;
listView1.View = View.Details;
lanye_purple 2007-01-31
  • 打赏
  • 举报
回复
有誰知道嗎。
lanye_purple 2007-01-31
  • 打赏
  • 举报
回复
this.listView1.Columns.Add("一等奖号码",100 ,HorizontalAlignment.Center);

--------------------------------------
我不是上面的意思,可能是我說的不清楚。解釋如下:

一等奖号码
口123
口456
口789
二等奖号码
口111
口422
口733
NoirCheng 2007-01-31
  • 打赏
  • 举报
回复
this.listView1.View =Details
this.listView1.CheckBoxes = true;
this.listView1.Columns.Add("一等奖号码",100 ,HorizontalAlignment.Center);
this.listView1.Items.Add("123");
this.listView1.Items.Add("456");
this.listView1.Items.Add("789");
this.listView1.Size.Width = listView1.Columns[0].Width;
QQ576006 2007-01-31
  • 打赏
  • 举报
回复
checkbox的属性是针对所有项的,不可以针对某一条listitem进行单独设置。
要实现你说的这种,可以尝试以下办法:
1.加图标的方式,分别制作checked与unchecked图标;
2.根据listitem类型添加图标;
2.处理ItemClick事件,更换图标;
aierduo 2007-01-31
  • 打赏
  • 举报
回复
完整的是:
System.Windows.Forms.ColumnHeader columnHeader1=new ColumnHeader ();
columnHeader1.Text ="一等奖";
this.listView1.View =Details
this.listView1.CheckBoxes = true;
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {this.columnHeader1});
this.listView1.Items.Add("123");
this.listView1.Items.Add("456");
this.listView1.Items.Add("789");
aierduo 2007-01-31
  • 打赏
  • 举报
回复
this.listView1.View =Details
this.listView1.CheckBoxes = true;
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {this.columnHeader1});
this.listView1.Items.Add("123");
this.listView1.Items.Add("456");
this.listView1.Items.Add("789");
1.兼容msi,自动高亮目标程序,实时生成脚本 2.可导入其他非i-Autoit创建的Au3脚本并编译为EXE 3.自动读取安装程序图标,编译时也可以选择其他图标 4.可自定义编译EXE版本信息 5.支持组件多控件选择(例如标准树形treeviw、列表listview控件)、文本edit控件修改文本(例如安装路径、序列号输入) 6.新增隐藏自动安装模式,不过尚未完美 7.模式切换分为控件模式和鼠标位置模式,切换快捷键和暂停捕捉快捷键均可自定义设置 8.可自定义是否在控件点击时左上角提示相关信息 9.可自定义运行脚本是否需要托盘提示目前代码行数和对应代码 10.其他功能(打包、删除文件,添加、删除启动项,查杀进程和随机窗口)可方便生成相应代码并可一键复制 日后根据反馈陆续推出动画教程,暂时补个简单文字教程: 1.将目标程序拖到“安装程序”的文本框,点击运行 2.程序启动并高亮置顶,此时别太,尤其是那些需要释放文件的程序,稍等片刻再开始按照正常安装步骤点击相应按钮 3.如果需要修改安装路径或输入注册码,请在第1步前将路径复制好,然后单击文本框,会弹出一个提示框,输入需要修改的路径即可 4.检测到点击其他控件(标准树形treeviw、列表listview控件)会自动转换成相对位置点击 5.某些控件如果发现不支持或者控件结构非常复杂,可以尝试切换为鼠标模式用相对位置模拟点击 6.如果需要关闭进程或者窗口之类的,可以在“其他功能”里面的选项使用对应功能生成代码并一键复制后转到“安装脚本”选择合适位置右键选择粘贴代码即可 7.测试代码:在“安装脚本”界面右键选择“测试代码”即可生成临时测试程序并运行 8.编译代码:选择图标或保留源程序图标后再自定义版本信息(也可不定义)编译即可,在目标程序同目录下生成安装脚本程序 9.导入脚本:将目标脚本拖入“运行编译”的“安装脚本”右侧文本框,点击导入即可 10.隐藏安装模式:部分软件无法兼容,还需继续更新完善,有兴趣的可以自行测试

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧