初审后编辑部处理中:如何制作自己的博客呢?

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 05:06:05

在通常情况下,listview的列头是按钮式的,如果你想把列头做成平面式的,那就用我的方法试试,源码如下

Option Explicit

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const GWL_STYLE = (-16)
Private Const LVM_FIRST = &H1000
Private Const LVM_GETHEADER = (LVM_FIRST + 31)
Private Const HDS_BUTTONS = &H2

Private Sub Form_Load()

Dim hHeader As Long, lStyle As Long
Dim i As Integer
ListView1.View = lvwReport
With ListView1.ColumnHeaders
.Add , , "编号", 500, lvwColumnLeft
For i = 1 To 10
.Add , , "内容项" & i, 1000, lvwColumnRight
Next
End With

hHeader = SendMessage(ListView1.hWnd, LVM_GETHEADER, 0, ByVal 0&)
lStyle = GetWindowLong(hHeader, GWL_STYLE)
SetWindowLong hHeader, GWL_STYLE, lStyle Xor HDS_BUTTONS
End Sub