Help Center

CListView.SetIconSpacingmethod

Sets the spacing between icons in list-view controls set to the LVS_ICON style.

WindowsmethodCListView.incdocumented

Syntax

FUNCTION SetIconSpacing (BYVAL hListView AS HWND, BYVAL cx AS SHORT, BYVAL cy AS SHORT) AS DWORD

Parameters

NameDescription
hListViewHandle to the ListView control.
cxThe distance, in pixels, to set between icons on the x-axis.
cyThe distance, in pixels, to set between icons on the y-axis.

Return value

Returns a DWORD value that contains the previous x-axis distance in the low word, and the previous y-axis distance in the high word.

Description

Sets the spacing between icons in list-view controls set to the LVS_ICON style.

Remarks

The cx and cy parameters are relative to the upper-left corner of an icon bitmap. Therefore, to set spacing between icons that do not overlap, the cx or cy values must include the size of the icon, plus the amount of empty space desired between icons. Values that do not include the width of the icon will result in overlaps.

When defining the icon spacing, cx and cy must set to 4 or larger. Smaller values will not yield the desired layout. You can reset cx and cy to the default spacing by setting both values to -1. This approach only allows you to reset both default settings. You cannot reset only cx or cy to the default setting by setting one of them to -1.

Reference

  • Include file CListView.inc
  • Defined in AfxNova/CListView.inc:1588
  • Documented in Windows/WIndows Controls/CListView Class.md
  • Topic: CListView Class