你的位置: iPc 首页 > 全部文章 > 编程技术 > 阅读文章
科学X网    Office    苹果中国    微软中国    VPS

VB在listview控件标题上添加图标的模块

11
四月

在listview 控件标题上添加图标的模块.作者:Mndsoft 日期:2005-03-06

[codes=vb]’以下添加到模块中.
‘调用很简单,直接看好了.
Private Type LVCOLUMN
mask As Long
fmt As Long
cx As Long
pszText As String
cchTextMax As Long
iSubItem As Long
iImage As Long
iOrder As Long
End Type

Declare Function SendMessageColumn Lib “user32” Alias “SendMessageA” (ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, lParam As Any) As Long
Const LVM_FIRST = &H1000
‘ListView Column Header constants
Const LVCF_FMT = &H1
Const LVCF_WIDTH = &H2
Const LVCF_TEXT = &H4
Const LVCF_SUBITEM = &H8
Const LVCF_IMAGE = &H10
Const LVCF_ORDER = &H20

Const LVCFMT_LEFT = &H0
Const LVCFMT_RIGHT = &H1
Const LVCFMT_CENTER = &H2
Const LVCFMT_JUSTIFYMASK = &H3
Const LVCFMT_IMAGE = &H800
Const LVCFMT_BITMAP_ON_RIGHT = &H1000
Const LVCFMT_COL_HAS_IMAGES = &H8000

Public Sub ColumnHeaderSetIcon(LView As ListView, Column As ColumnHeader, Img As ListImage)
Dim col As LVCOLUMN
Dim ret As Long
col.mask = LVCF_FMT or LVCF_IMAGE
col.fmt = LVCFMT_LEFT or LVCFMT_IMAGE or LVCFMT_COL_HAS_IMAGES
col.iImage = Img.Index – 1
ret = SendMessageColumn(LView.hWnd, LVM_FIRST + 26, Column.Index – 1, col)
End Sub[/codes]

关于本文
  • 属于分类:编程技术
  • 本文标签:,
  • 文章编辑:
  • 流行热度:正在感受现场气氛...
  • 生产日期:2007年04月11日 - 1时39分00秒

微博评论箱