Hi all,
I m trying to have a listview with gridlines. this will make the
listview look like a datagrid. any help would be appreciated.

I have tried to use the samples concerning the owner-drawn list,
unfortunately those samples only deal with listboxes (only one column).
Besides it's like rewriting from scratch a listview control, and i m
sure it will be hard and not as efficient as the already existing
listview control, so i m leaving this as a last option (unless someone
can show me a sample of a listview with owner drawn list)

I tried to inherits from a listview control and override the OnPaint
event (the first obvious choice of course) but that didn't work coz the
onPaint isn't called, apparently it's the form who does the painting of
the control.

I also tried P/Invoke with these constants: (actually i took the code
posted in this newsgroup entiteled "P/Invoke and ListView" posted by
Zahid)
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE As Integer
= &H1037
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE As Integer
= &H1036
Private Const LVS_EX_GRIDLINES As Integer = &H1


I don't know if that works with other people or if i missed something,
but the result was very disapointing.
the lines were in the middle of the listview items,it's really not
beautiful to see.

so anyone can tell me how can i have a listview with gridlines ?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Re: listview with gridlines by Peter

Peter
Wed Oct 06 04:00:57 CDT 2004

There is a sample here to P/Invoke to set gridlines on the control. Be aware
that there is a known issue with the native control where if you have the
list header visible the horizontal gridlines will cut across your text
items - so you'll have to disable the standard list header.
http://www.businessanyplace.net/?p=code#listviewgrid

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

"Joe Abou Jaoude" <anonymous@hotmail.com> wrote in message
news:O7Ewp$3qEHA.596@TK2MSFTNGP11.phx.gbl...
>
> Hi all,
> I m trying to have a listview with gridlines. this will make the
> listview look like a datagrid. any help would be appreciated.
>
> I have tried to use the samples concerning the owner-drawn list,
> unfortunately those samples only deal with listboxes (only one column).
> Besides it's like rewriting from scratch a listview control, and i m
> sure it will be hard and not as efficient as the already existing
> listview control, so i m leaving this as a last option (unless someone
> can show me a sample of a listview with owner drawn list)
>
> I tried to inherits from a listview control and override the OnPaint
> event (the first obvious choice of course) but that didn't work coz the
> onPaint isn't called, apparently it's the form who does the painting of
> the control.
>
> I also tried P/Invoke with these constants: (actually i took the code
> posted in this newsgroup entiteled "P/Invoke and ListView" posted by
> Zahid)
> Private Const LVM_GETEXTENDEDLISTVIEWSTYLE As Integer
> = &H1037
> Private Const LVM_SETEXTENDEDLISTVIEWSTYLE As Integer
> = &H1036
> Private Const LVS_EX_GRIDLINES As Integer = &H1
>
>
> I don't know if that works with other people or if i missed something,
> but the result was very disapointing.
> the lines were in the middle of the listview items,it's really not
> beautiful to see.
>
> so anyone can tell me how can i have a listview with gridlines ?
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!