Knowledgebase

status_loader

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.

Need further help getting started?

You did not find what you were looking for? Please contact us so we can provide an answer to your question.

Contact Form