VB ListView 隔行背景

VB ListView 隔行背景,第1张

概述Private Sub SetListViewColor(Lv As ListView, pic As PictureBox, LvCount As Long) Dim i As Integer pic.BackColor = Lv.BackColor Lv.Parent.ScaleMode = vbTwips pic.ScaleMode = vbTwips
Private Sub SetListVIEwcolor(Lv As ListVIEw,pic As PictureBox,LvCount As Long)   Dim i As Integer   pic.Backcolor = Lv.Backcolor   Lv.Parent.ScaleMode = vbTwips    pic.ScaleMode = vbTwips    pic.borderStyle = vbBSNone    pic.autoRedraw = True    pic.Visible = False    pic.WIDth = Screen.WIDth   '因为我的ListVIEW会自动调整大小的,所以直接用屏幕的宽度    pic.Height = Lv.ListItems(1).Height * LvCount '取得要添充的高度    pic.ScaleHeight = LvCount    pic.ScaleWIDth = 1    pic.DrawWIDth = 1    '-----------------------------    '画出每行ListVIEW的颜色    '------------------------------    For i = 1 To LvCount               If i / 2 = Int(i / 2) Then                                    pic.line (0,i - 1)-(1,i),&HC0FFFF,BF        Else            pic.line (0,16777152,BF        End If    Next    Lv.Picture = pic.Image    End SubPrivate Sub SetListVIEwcolor(Lv As ListVIEw,pic As PictureBox)    Dim h               As Single    Dim sw              As Single    Dim oAltBackcolor   As olE_color        oAltBackcolor = pic.Backcolor        With Lv        If .VIEw = lvwReport Then            If .ListItems.Count Then                .PictureAlignment = lvwTile                h = .ListItems(1).Height                With pic                    .Visible = False                    .Backcolor = Lv.Backcolor                    .borderStyle = 0                    .Height = h * 2                    .WIDth = 10 * Screen.TwipsPerPixelX                    sw = .ScaleWIDth                    .autoRedraw = True                    If StartAtOddRow Then                        pic.line (0,0)-Step(sw,h - Screen.TwipsPerPixelY),oAltBackcolor,BF                    Else                        pic.line (0,h)-Step(sw,h),BF                    End If                    Set Lv.Picture = .Image                    .autoRedraw = False                    .Backcolor = oAltBackcolor                End With                .Refresh                Exit Sub            End If        End If        Set .Picture = nothing    End With    End Sub
总结

以上是内存溢出为你收集整理的VB ListView 隔行背景全部内容,希望文章能够帮你解决VB ListView 隔行背景所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1281021.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存