Draw subitem in SysListView32
-
I am creating the control based on SysListView32. Can some tell me how can i draw the subitems in OnDrawItem event.
Check out Neat Stuff to do in List Controls Using Custom Draw[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Pinky, are you pondering what I'm pondering? I think so Brain, but how will we fit the hamster inside the accordion? You cannot stop me with paramecium alone!
-
Check out Neat Stuff to do in List Controls Using Custom Draw[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Pinky, are you pondering what I'm pondering? I think so Brain, but how will we fit the hamster inside the accordion? You cannot stop me with paramecium alone!
Thanks.... I have try this code it works fine... but When i tried to draw a rectangle around the subitem in POSTPAINT event it did not work. Please see the code below
else if ( (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage ) { if ( 0 == pLVCD->iSubItem ) { RECT rc; HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } else if ( 1 == pLVCD->iSubItem ) { HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } *pResult = CDRF_SKIPDEFAULT; }
Please tell me whats wrong with this code.... Secondly can i display combo on one of the column using the CustomDraw event. -
Thanks.... I have try this code it works fine... but When i tried to draw a rectangle around the subitem in POSTPAINT event it did not work. Please see the code below
else if ( (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage ) { if ( 0 == pLVCD->iSubItem ) { RECT rc; HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } else if ( 1 == pLVCD->iSubItem ) { HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } *pResult = CDRF_SKIPDEFAULT; }
Please tell me whats wrong with this code.... Secondly can i display combo on one of the column using the CustomDraw event.Check the rectangle that you're drawing. From the docs for
NMCUSTOMDRAW
:rc
RECT structure that describes the bounding rectangle of the area being drawn. This member is initialized only by the CDDS_ITEMPREPAINT notification. Version 5.80. This member is also initialized by the CDDS_PREPAINT notification.
--Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer." -- Michael P. Butler in the Lounge
-
Check the rectangle that you're drawing. From the docs for
NMCUSTOMDRAW
:rc
RECT structure that describes the bounding rectangle of the area being drawn. This member is initialized only by the CDDS_ITEMPREPAINT notification. Version 5.80. This member is also initialized by the CDDS_PREPAINT notification.
--Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer." -- Michael P. Butler in the Lounge