请问;listview控件怎么实现网格
我用的是vb 6.0,怎么实现网格?
[解决办法]
ListView1.View = lvwReport
ListView1.GridLines = True
别忘了添加列
[解决办法]
这是Listview基本的属性,补丁未打。
VB6最新补丁是SP6,2004年更新
For Microsoft Windows Common Controls 5.0 (SP2) ---COMCTL32.DLL
看不到GridLines 属性,但API能实现。
For Microsoft Windows Common Controls 6.0 (SP6) ---Mscomctl.DLL
直接看到GridLines 属性。
Private Const LVS_EX_GRIDLINES As Long = &H1&
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 55)
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = (LVM_FIRST + 54)
Private Declare Function SendMessageLongA Lib "user32 " Alias "SendMessageA " (ByVal hwnd As Long,ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Sub GridLines(Byval LVhWnd as Long,ByVal PropVal As Boolean)
'*/ change gridlines state
If Not LVhWnd = 0 Then
If PropVal Then
SetExtendedStyle LVS_EX_GRIDLINES, 0
Else
SetExtendedStyle 0, LVS_EX_GRIDLINES
End If
End If
End Sub
Private Sub SetExtendedStyle(ByVal LVhWnd as Long,ByVal lStyle As Long,ByVal lStyleNot As Long)
'*/ change list extended style params
Dim lNewStyle As Long
lNewStyle = SendMessageLongA(LVhWnd , LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
lNewStyle = lNewStyle And Not lStyleNot
lNewStyle = lNewStyle Or lStyle
SendMessageLongA LVhWnd , LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, lNewStyle
End Sub