FAQ & Knowledge Base

Welcome to our Knowledge Base. Search or browse through the topics below to find answers to your questions.

Categories: ShellBrowser Delphi Components | Show all categories

Changing spacing in icons view

Question / Problem

How can I add more or less space between the items in the TJamShellList or TJamFileList?

Answer / Solution

In icon based viewstates (viewstyle = vsIcon) you can use the Win32 function "ListView_SetIconSpacing" to determine horizontal and vertical spacing in the ListView.

The following code reduces the vertical space by 10 Pixels:

var lSpace, lVert, lHoriz: DWord;
begin
  lSpace := ListView_GetItemSpacing(ListView1.Handle, 0);
  lVert := HiWord(lSpace);
  lHoriz := LoWord(lSpace);
  ListView_SetIconSpacing(ListView1.Handle, lHoriz, lVert - 10); //unit CommCtrl
  ListView1.Invalidate();
end;

Note, that this might result in overlapping items.