Hi,

Could somebody please tell me if it is possible to do:

a) Change the background colour of each item in a listview. I know that the
forecolour change is possible.

b) To automatically resize a column in a listview based on the maximum width
of the cells in that column

Thank you for your time.
Vince

Re: Listview Colour & Column width by alpine

alpine
Wed Nov 03 09:18:32 CST 2004

On Wed, 3 Nov 2004 22:15:17 +0800, "Vince"
<nmvkPLEASERMVTHIS@vsnl.net> wrote:

>Hi,
>
>Could somebody please tell me if it is possible to do:
>
>a) Change the background colour of each item in a listview. I know that the
>forecolour change is possible.

Yes, you can subclass the NM_CUSTOMDRAW message and customize the
control any way you like. For a very basic example of subclassing
NM_CUSTOMDRAW, have a look at the CustomDrawLV project at
http://www.mvps.org/vbvision/


>b) To automatically resize a column in a listview based on the maximum width
>of the cells in that column

Yes, you can send a LVM_SETCOLUMNWIDTH message with either the
LVSCW_AUTOSIZE or LVSCW_AUTOSIZE_USEHEADER flag.

HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas

Re: Listview Colour & Column width by Vince

Vince
Thu Nov 04 02:55:18 CST 2004

Thank you.
I'll have to test to see if it causes other list views or the program to
crash..

"alpine" <alpine_don'tsendspam@mvps.org> wrote in message
news:a6tho0tmil1m659tapd6iuj7opr209geda@4ax.com...
> On Wed, 3 Nov 2004 22:15:17 +0800, "Vince"
> <nmvkPLEASERMVTHIS@vsnl.net> wrote:
>
> >Hi,
> >
> >Could somebody please tell me if it is possible to do:
> >
> >a) Change the background colour of each item in a listview. I know that
the
> >forecolour change is possible.
>
> Yes, you can subclass the NM_CUSTOMDRAW message and customize the
> control any way you like. For a very basic example of subclassing
> NM_CUSTOMDRAW, have a look at the CustomDrawLV project at
> http://www.mvps.org/vbvision/
>
>
> >b) To automatically resize a column in a listview based on the maximum
width
> >of the cells in that column
>
> Yes, you can send a LVM_SETCOLUMNWIDTH message with either the
> LVSCW_AUTOSIZE or LVSCW_AUTOSIZE_USEHEADER flag.
>
> HTH,
> Bryan
> ____________________________________________________________
> New Vision Software "When the going gets weird,"
> Bryan Stafford "the weird turn pro."
> alpine_don'tsendspam@mvps.org Hunter S. Thompson -
> Microsoft MVP-Visual Basic Fear and Loathing in LasVegas