October 29, 2025, 05:54:51 AM

News:

IWBasic runs in Windows 11!


Grid Lines in LISTVIEW

Started by billhsln, August 24, 2007, 04:03:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

control w1,@listview,"",10,120,screenw,200,1|@border,12
setfont w1,"Arial",12,400,0,12

SENDMESSAGE w1,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT,12:'Set full row select
SENDMESSAGE w1.hWnd,0x1036,0x1,-1,12:'Set gridlines on
SENDMESSAGE w1.hWnd,0x1024,0,0x000000,12:'Set text colour
SENDMESSAGE w1.hWnd,0x1026,0,0xF7DFD6,12:'Set text background colour
SENDMESSAGE w1.hWnd,0x1001,0,0xF7DFD6,12:'Set background colour


In the above snippet, from Brian Pugh's BookShop program, the comment on the 5th line says 'Set grildlines on'.  I can not find any where in the documentation that talks about grid lines and how to turn them on and off.  Would also like to know how to set their color.  Any help will be appreciated.

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

CONST LVS_EX_GRIDLINES = 1

SENDMESSAGE w1,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES ,12:'Set full row select


Look at the "listview - noresize" example in the project folder.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

srod

SendMessage w1, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_GRIDLINES, LVS_EX_GRIDLINES, id


will turn the gridlines on,

SendMessage w1, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_GRIDLINES, 0, id


will turn them off.

As for gridline colour?  Interesting question.  Never thought about that before. With previous projects I've drawn the gridlines myself to avoid certain problems with the native gridlines which of course meant that I could choose the colour. I've never encountered an api function which will allow the colour to be changed.  I'll have a look on MSDN.

srod

August 25, 2007, 01:10:43 PM #3 Last Edit: August 25, 2007, 01:31:40 PM by srod
I just asked one of the Purebasic creators how he coloured the gridlines in the Window's ListView control.

The answer was that he custom drew them (as I have done in the past) as he could find no other way of doing it.  Believe me, if this guy could find no other way, then there is a 99.9999% chance of being no other way!  :)

Reckon you'll need to roll your sleeves up therefore and get stuck into Custom Draw methods.  It's good fun!