by The typist (1 Submission)
Category: Windows API Call/Explanation
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating:
(3 Votes)

This is a demo which shows how to control the icon spacing in a listview's icon view. The demo is an easy to use wrapper around the LVM_SETICONSPACING api message. You only need to submit the x, y icon spacing in twips and then the code does the rest of it.
API DeclarationsOption Explicit
'
' Listview api messages.
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_SETICONSPACING = LVM_FIRST + 53
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length 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
Download ListView Icon Spacing (35 KB)