TA的每日心情 | 开心 5 天前 |
|---|
签到天数: 78 天 [LV.6]常住居民II
管理员
- 积分
- 2434
|
如上图,可设置节点默认的文字颜色(黑),节点选中时文字颜色(绿),节点的所有父节点的文字颜色(红)
此效果为扩展后的效果,
| /** | | * @brief Text color of selected items's parent. | | */ | | COLORREF m_crItemSelParentText; | | | | /** | | * @brief Flag indicating if lines are drawn between items. | | */ |
| @@ -811,6 +816,7 @@ class SOUI_EXP STreeCtrl | | ATTR_COLOR(L"colorItemSelBkgnd", m_crItemSelBg, FALSE) | | ATTR_COLOR(L"colorItemText", m_crItemText, FALSE) | | ATTR_COLOR(L"colorItemSelText", m_crItemSelText, FALSE) | | ATTR_COLOR(L"colorItemSelParentText", m_crItemSelParentText, FALSE) | | ATTR_BOOL(L"hasLines", m_bHasLines, TRUE) | | SOUI_ATTRS_END() |
, m_crItemSelBg(RGBA(0, 0, 136, 255))
, m_crItemText(RGBA(0, 0, 0, 255))
, m_crItemSelText(RGBA(255, 255, 255, 255))
, m_crItemSelParentText(RGBA(255, 255, 255, 255))
, m_nVisibleItems(0)
, m_nContentWidth(0)
, m_bCheckBox(FALSE)
| | if (m_hSelItem) | | { | | bool bFindParent = false; | | HSTREEITEM hParent = GetParentItem(m_hSelItem); | | while (hParent && !bFindParent) | | { | | if (hItem == hParent) | | { | | bFindParent = true; | | break; | | } | | hParent = GetParentItem(hParent); | | } | | if (CR_INVALID != m_crItemSelParentText && bFindParent) | | { | | bTextColorChanged = TRUE; | | crOldText = pRT->SetTextColor(m_crItemSelParentText); | | } | | } | | } | | | | if (pItem->bHasChildren && STVIMask_Toggle == (m_uItemMask & STVIMask_Toggle) && !m_bHasLines) |
|
|