在通常情况下,listview的列头是按钮式的,如果你想把列头做成平面式的,那就用我的方法试试,源码如下 option explicit private declare function getwindowlong lib "user32" alias "getwindowlonga" (byval hwnd as long, byval nindex as long) as long private const gwl_style = (-16) private sub form_load() dim hheader as long, lstyle as long hheader = sendmessage(listview1.hwnd, lvm_getheader, 0, byval 0&) 完
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 lvm_first = &h1000
private const lvm_getheader = (lvm_first + 31)
private const hds_buttons = &h2
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
lstyle = getwindowlong(hheader, gwl_style)
setwindowlong hheader, gwl_style, lstyle xor hds_buttons
end sub