怎么控制ListView图标之间的距离

 我来答
奔跑的窝牛的家
高粉答主

2016-10-21 · 每个回答都超有意思的
知道顶级答主
回答量:3.6万
采纳率:98%
帮助的人:4588万
展开全部
‘VB中使用SendMessage 控制listview图标间距
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Const LVM_FIRST = &H1000
Const LVM_SETWORKAREA = LVM_FIRST + 65
Const LVM_SETICONSPACING = LVM_FIRST + 53
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 Sub Form_Load()
Dim xn As ListItem
Dim Rects As RECT
Dim i As Integer
ListView1.Arrange = lvwAutoLeft
ListView1.View = lvwIcon
Me.Show
For i = 100 To 110
ListView1.ListItems.Add , , i
Next
With Rects
.Left = 100
.Top = 100
.Right = ListView1.Width / Screen.TwipsPerPixelX
.Bottom = ListView1.Height / Screen.TwipsPerPixelX
End With
'下面这句用来控制区域
SendMessage ListView1.hwnd, LVM_SETWORKAREA, 1, Rects
'下面这句用来控制ListItem之间的距离,横向间距80像素,纵向间距50像素
Call SendMessage(ListView1.hwnd, LVM_SETICONSPACING, 0, ByVal (50 * 65536 + 80&))
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式