Listview control problems

  • Thread starter Thread starter chris-s
  • Start date Start date
C

chris-s

Hi folks,

For the first time, I've come to use the native 'ListView' control and
have a couple of problems. Searching the newsgroups, I see there seem
to be a few problems reported with this control, but none appear to
match what I am experiencing, so I'll have to ask you knowledgable
people...

I'm using the control to display a fixed number of pre-determined items
in 'LargeIcon' style with 32x32 pixel images and a short textual
description (2 words each).

At design time, the listview items are laid out in multiple rows of
three which makes for a neat appearance with each items text clearly
visible, however, at runtime it displays the items in rows of four and
shortens the text which makes for a less tidy appearance.

I tried to trick it into displaying in rows of three by narrowing the
width of the listview control, which works, except that the item images
are cropped being overwritten by the text label of the item above.

So what control do I have over the layout of items within the control
to overcome these problems?

Cheers,

Chris
 
Via a bit of P/Invoke you can send an LVM_SETICONSPACING message to the
control to set the horizontal and vertical size of each item. You'll need to
set Capture = true on the control then P/Invoke GetCapture(), and
SendMessage to send the message to that window. You'll find the necessary
P/Invokes are already available in OpenNETCF (www.opennetcf.org/sdf/)

Peter
 
Back
Top