Changing font & color of tree view Items 
Author Message
 Changing font & color of tree view Items

Hi,
Can anybody show me an example piece of code on how to
change font and color of individual items in a tree
control ? The NM_CUSTOMDRAW seems to return a wrong val.
the code is like this :
case NM_CUSTOMDRAW: {
LPNMTVCUSTOMDRAW lplvcd = (LPNMTVCUSTOMDRAW) lParam;
LPNODEINFO node = LPNODEINFO (lplvcd->nmcd.lItemlParam);
 switch(lplvcd->nmcd.dwDrawStage) {
   case CDDS_PREPAINT :                                
   return CDRF_NOTIFYITEMDRAW;
  case CDDS_SUBITEM | CDDS_ITEMPREPAINT: {
  if (node->level == ROOT)
 {
  HFONT hf = DlgClass::BoldFont();
  SelectObject(lplvcd->nmcd.hdc, hf);
   }
if (node->level == INTER)
lplvcd->clrText = RGB (0xff, 0, 0);                  

if (node->level == LEAF)
return CDRF_DODEFAULT;
return CDRF_NEWFONT;

Quote:
}
}

Thanx,
mark.


Fri, 23 Jul 2004 07:25:11 GMT  
 Changing font & color of tree view Items
Hello,

This article is for your reference. http://www.codeguru.com/treeview/item_color_font.shtml

Hope this helps.

Regards,
Max
==========================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

Quote:
>>Content-Class: urn:content-classes:message


>>Subject: Changing font & color of tree view Items

>>Hi,
>>Can anybody show me an example piece of code on how to
>>change font and color of individual items in a tree
>>control ? The NM_CUSTOMDRAW seems to return a wrong val.
>>the code is like this :
>>case NM_CUSTOMDRAW: {
>>LPNMTVCUSTOMDRAW lplvcd = (LPNMTVCUSTOMDRAW) lParam;
>>LPNODEINFO node = LPNODEINFO (lplvcd->nmcd.lItemlParam);
>> switch(lplvcd->nmcd.dwDrawStage) {
>>   case CDDS_PREPAINT :                                
>>   return CDRF_NOTIFYITEMDRAW;
>>  case CDDS_SUBITEM | CDDS_ITEMPREPAINT: {
>>  if (node->level == ROOT)
>> {
>>  HFONT hf = DlgClass::BoldFont();
>>  SelectObject(lplvcd->nmcd.hdc, hf);
>>   }
>>if (node->level == INTER)
>>lplvcd->clrText = RGB (0xff, 0, 0);                  

>>if (node->level == LEAF)
>>return CDRF_DODEFAULT;
>>return CDRF_NEWFONT;
>>}
>>}
>>Thanx,
>>mark.



Sat, 24 Jul 2004 10:20:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to change font for a List View/Tree View like Windows Explorer

2. Change bitmap colors when cut item from tree control

3. Can we change color of some Items in Tree Control

4. changing tree view background color...

5. Changing color of item in list view

6. Changing color of item in list view

7. Change List View Ctrl default font and background color

8. CListrCtrl & Change Color and/or Font :: MFC

9. Changing font & color in edit control

10. How to change static text FONT & COLOR

11. CEditView Background Color & Font Color :: MFC

12. Changing font & font size for CListView windows

 

 
Powered by phpBB® Forum Software