彩票走势图

如何制作平面式的listview列头

翻译|其它|编辑:郝浩|2004-01-12 21:43:00.000|阅读 1538 次

概述:

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

在通常情况下,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


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP