Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make listview row Bold and Red

57 views
Skip to first unread message

John Martens

unread,
Apr 6, 2001, 3:42:21 AM4/6/01
to
After quite some struggles I made a listview where I can color a row (eg
background black en forground white)

I like the look of eg Outlook Express News Reader more.
When an item is marked and a new item has been downloaded the item is red
and bold. When I've read it it becomes only bold.

Has anyone a piece of code that does the coloring and the bold typeface ?

John Martens


Paul Piko

unread,
Apr 6, 2001, 9:38:43 AM4/6/01
to
John,

"John Martens" <jco.m...@tref.nl> wrote in message
news:9akfop$4kem1$2...@reader02.wxs.nl...

Try the code below. In it SELF:hBoldFont is the handle to a bold font
created earlier, oDCList is the listview, WinSTLV is the window.

--
Paul
----
Paul Piko
Piko Computing Consultants
Phone: +61 3 9432 1222 Fax: +61 3 9432 1255
Email: pa...@piko.com.au Web: http://www.piko.com.au


METHOD ControlNotify( oEvent ) CLASS WinSTLV

LOCAL pNMCustomDraw AS _WINNMLVCUSTOMDRAW
LOCAL dwDrawStage AS DWORD
LOCAL oLVI AS listviewitem

DO CASE
CASE oEvent:NotifyCode = NM_CUSTOMDRAW
pNMCustomDraw := PTR( _CAST , oEvent:lParam )
dwDrawStage := pNMCustomDraw.nmcd.dwDrawStage
DO CASE
CASE dwDrawStage = CDDS_PREPAINT
SELF:EventReturnValue := CDRF_NOTIFYSUBITEMDRAW
CASE dwDrawStage = CDDS_ITEMPREPAINT
IF pNMCustomDraw.nmcd.hdr.hwndFrom == SELF:oDCList:handle()
oLVI :=
SELF:oDClist:getitemattributes(pNMCustomDraw.nmcd.dwItemSpec+1)

// Put your own test here...
IF oLVI:GetText(#subType) == "Class"
SelectObject(pNMCustomDraw.nmcd.hdc,SELF:hBoldFont)

// Background grey
pNMCustomDraw.clrTextBk := RGB( 192 , 192 , 192 )

// Red text
pNMCustomDraw.clrText := RGB( 255 , 0 , 0 )
ENDIF

SELF:EventReturnValue := CDRF_NEWFONT
ELSE
SELF:EventReturnValue := CDRF_DODEFAULT
ENDIF
OTHERWISE
SELF:EventReturnValue := CDRF_DODEFAULT
ENDCASE
SetWindowLong( SELF:Handle() , DWL_MSGRESULT , SELF:EventReturnValue )
RETURN SELF:EventReturnValue
ENDCASE
RETURN SUPER:ControlNotify(oEvent)


John Martens

unread,
Apr 6, 2001, 11:13:26 AM4/6/01
to
Best things in life are for free and simple.
Thanks very much.

John


Paul Piko <pa...@piko.com.au> schreef in berichtnieuws
DFjz6.7786$Xi1....@news-server.bigpond.net.au...

0 new messages