• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C#winform中ListView用法

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
            this.listView1.GridLines = true; //显示表格线
            this.listView1.View = View.Details;//显示表格细节
            this.listView1.LabelEdit = true; //是否可编辑,ListView只可编辑第一列。
            this.listView1.Scrollable = true;//有滚动条
            this.listView1.HeaderStyle = ColumnHeaderStyle.Clickable;//对表头进行设置
            this.listView1.FullRowSelect = true;//是否可以选择行

            //this.listView1.HotTracking = true;// 当选择此属性时则HoverSelection自动为true和Activation属性为oneClick
            //this.listView1.HoverSelection = true;
            //this.listView1.Activation = ItemActivation.Standard; //
            //添加表头
            this.listView1.Columns.Add("", 0);
            this.listView1.Columns.Add("列1",80);
            this.listView1.Columns.Add("列2", 160);
            //添加各项
            ListViewItem[] p = new ListViewItem[2];
            p[0] = new ListViewItem(new string[] { "","aaaa","bbbb"});
            p[1] = new ListViewItem(new string[] { "","cccc", "ggggg" });
            //p[0].SubItems[0].BackColor = Color.Red; //用于设置某行的背景颜色

            this.listView1.Items.AddRange(p);
            //也可以用this.listView1.Items.Add();不过需要在使用的前后添加Begin... 和End...防止界面自动刷新
            // 添加分组
            this.listView1.Groups.Add(new ListViewGroup("tou"));
            this.listView1.Groups.Add(new ListViewGroup("wei"));

            this.listView1.Items[0].Group = this.listView1.Groups[0];
            this.listView1.Items[1].Group = this.listView1.Groups[1];

 

listview,怎么也没找到从那个地方调整item的行高, 找来找去也没发现,真想大骂微软一下,仔细思考一下,因该有2种方式,一种重写listview,另外一种listview肯定有相关属性来调整行高,功夫不负有心人。

网上有个写高人,通过如下方式来实现

1,添加一imagelist控件

2,指定listview的smallimages属性为imagelist1

3,只需要调整imagelist中图像高度.listview控件中的高度随之调整。

非常简单的小问题

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
asp.net(C#)中Repeater嵌套绑定Repeater发布时间:2022-07-10
下一篇:
C#基础之if语句习题发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap