visual studio 2008 - Changing the color of a selected CTreeCtrl item? -


(using the CTreeCtrl), I need to select the text "itemprop =" text ">

(VS2008, MFC, feature pack) after

Pay attention to the item "better" when the control loses focus.

My tree is created with the "TVS_SHOWSELALWAYS" option in the Resource Editor, but the color is not adequately visible.

I already have the custom color message (NM_CUSTOMDRAW) to change the item color via this type of code:

  zero MyTree :: OnCustomDraw (NMHDR * pNMHDR, LRESULT * PResult) {NMTVCUSTOMDRAW * PCD = (NMTVCUSTOMDRAW *) pNMHDR; Switch (PCD-> nmcd.dwDrawStage) {Case CDDS_PREPAINT: * pResult = CDRF_NOTIFYITEMDRAW; break; Case CDDS_ITEMPREPAINT: {HTREEITEM hItem = (HTREEITEM) pcd- & gt; Nmcd.dwItemSpec; If (this-> IsSelected (hItem)) {pcd- & gt; ClrText = GetSysColor (COLOR_HIGHLIGHTTEXT); Pcd- & gt; ClrTextBk = GetSysColor (COLOR_HIGHLIGHT); } * PResult = CDRF_DODEFAULT; // not set * pResult = CDRF_SKIPDEFAULT break; }}}  

It's working, but it's going to be overkill for a simple task as such.

I think I should be missing something obvious to do this without having to do this.

Anything simple?

Thank you.

After the

You can set the text of your chosen item by using bold. You will not need a custom draw for this and the less code is always better.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -