·上一篇:ASP 采集专用截取首尾字符串函数
·下一篇:VC++通过ini文件实现记录最近打开文件菜单
VB 设置ListView中指定一行的背景颜色
- VBScript code复制代码
'SetListViewBGColor(ListView控件名称,要设置的背景颜色行号,颜色值-默认:&HB6B4FF) Public Sub SetListViewBGColor(ByRef ListView As ListView, _ ByRef Index As Long, _ Optional BGColor As Long = &HB6B4FF) 'author:www.newxing.com Dim lineTop As Long, lineHeight As Integer Static Pic As PictureBox If Pic Is Nothing Then Set Pic = Controls.Add("VB.PictureBox", "picbg") lineHeight = ListView.ListItems(Index).Height lineTop = lineHeight * (Index - 1) With Pic .Cls .AutoRedraw = True .Visible = False .ScaleMode = vbTwips .Font = ListView.Font .BorderStyle = 1 .Appearance = 0 .Height = lineHeight * ListView.ListItems.Count + lineHeight .Width = ListView.Width End With Pic.Line (0, lineTop)-(Pic.Width, lineTop + lineHeight), BGColor, BF ListView.Picture = Pic.Image End Sub
如果是设置全部背景颜色的话,以下这样就可以了:
ListView1.BackColor = &HB6B4FF
评论内容只代表网友观点,与本站立场无关!
评论摘要(共 6 条,得分 357 分,平均 59 分)
查看完整评论
[回复] 6 楼 游客 打分:1 分 发表时间:2016-10-27
· 没有用啊
[回复] 5 楼 游客 打分:1 分 发表时间:2016-10-27
· 没有用
[回复] 4 楼 游客3233 打分:100 分 发表时间:2015-03-05
· 没有用啊。。。
[回复] 3 楼 游客 打分:85 分 发表时间:2015-03-05
· SetListViewBGColor 提示缺少“=”
[回复] 2 楼 游客 打分:85 分 发表时间:2013-07-24
· 项目特别多出现滚动条时位置不对,这句有问题"lineTop = lineHeight * (Index - 1)
&qu
[回复] 1 楼 游客 打分:85 分 发表时间:2011-12-04
· 如何引用这个函数啊???
[回复] 6 楼 游客 打分:1 分 发表时间:2016-10-27
· 没有用啊
[回复] 5 楼 游客 打分:1 分 发表时间:2016-10-27
· 没有用
[回复] 4 楼 游客3233 打分:100 分 发表时间:2015-03-05
· 没有用啊。。。
[回复] 3 楼 游客 打分:85 分 发表时间:2015-03-05
· SetListViewBGColor 提示缺少“=”
[回复] 2 楼 游客 打分:85 分 发表时间:2013-07-24
· 项目特别多出现滚动条时位置不对,这句有问题"lineTop = lineHeight * (Index - 1)
&qu
[回复] 1 楼 游客 打分:85 分 发表时间:2011-12-04
· 如何引用这个函数啊???