在使用一个控件之前,把控件的说明书从头到尾看一遍 MFC让开发人员变懒了.. Example// The pointer to my tree control. extern CTreeCtrl* pmyTreeCtrl; // The point to hit test. extern CPoint myPoint;// Show the item at the point myPoint in bold. UINT uFlags; HTREEITEM hItem = pmyTreeCtrl->HitTest(myPoint, &uFlags);if ((hItem != NULL) && (TVHT_ONITEM & uFlags)) { pmyTreeCtrl->SetItem(hItem, TVIF_STATE, NULL, 0, 0, TVIS_BOLD, TVIS_BOLD, 0); }
同意楼上的四星。 pmyTreeCtrl->SetItem(hItem, TVIF_STATE, NULL, 0, 0, TVIS_BOLD, TVIS_BOLD, 0); TVIS_BOLD The item is bold.TVIS_CUT The item is selected as part of a cut-and-paste operation. TVIS_DROPHILITED The item is selected as a drag-and-drop target.TVIS_EXPANDED The item's list of child items is currently expanded; that is, the child items are visible. This value applies only to parent items.TVIS_EXPANDEDONCE The item's list of child items has been expanded at least once. The TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages are not generated for parent items that have this state set in response to a TVM_EXPAND message. Using TVE_COLLAPSE and TVE_COLLAPSERESET with TVM_EXPAND will cause this state to be reset. This value applies only to parent items. TVIS_EXPANDPARTIAL Version 4.70. A partially expanded tree-view item. In this state, some, but not all, of the child items are visible and the parent item's plus symbol is displayed. TVIS_SELECTED The item is selected. Its appearance depends on whether it has the focus. The item will be drawn using the system colors for selection. Note: When you set or retrieve an item's overlay image index or state image index, you must specify the following masks in the stateMask member of the TVITEM structure. These values can also be used to mask off the state bits that are not of interest. TVIS_OVERLAYMASK Mask for the bits used to specify the item's overlay image index.TVIS_STATEIMAGEMASK Mask for the bits used to specify the item's state image index.TVIS_USERMASK
MFC让开发人员变懒了..
Example// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
// The point to hit test.
extern CPoint myPoint;// Show the item at the point myPoint in bold.
UINT uFlags;
HTREEITEM hItem = pmyTreeCtrl->HitTest(myPoint, &uFlags);if ((hItem != NULL) && (TVHT_ONITEM & uFlags))
{
pmyTreeCtrl->SetItem(hItem, TVIF_STATE, NULL, 0, 0, TVIS_BOLD,
TVIS_BOLD, 0);
}
pmyTreeCtrl->SetItem(hItem, TVIF_STATE, NULL, 0, 0, TVIS_BOLD,
TVIS_BOLD, 0);
TVIS_BOLD
The item is bold.TVIS_CUT
The item is selected as part of a cut-and-paste operation. TVIS_DROPHILITED
The item is selected as a drag-and-drop target.TVIS_EXPANDED
The item's list of child items is currently expanded; that is, the child items are visible. This value applies only to parent items.TVIS_EXPANDEDONCE
The item's list of child items has been expanded at least once. The TVN_ITEMEXPANDING and TVN_ITEMEXPANDED notification messages are not generated for parent items that have this state set in response to a TVM_EXPAND message. Using TVE_COLLAPSE and TVE_COLLAPSERESET with TVM_EXPAND will cause this state to be reset. This value applies only to parent items. TVIS_EXPANDPARTIAL
Version 4.70. A partially expanded tree-view item. In this state, some, but not all, of the child items are visible and the parent item's plus symbol is displayed. TVIS_SELECTED
The item is selected. Its appearance depends on whether it has the focus. The item will be drawn using the system colors for selection. Note:
When you set or retrieve an item's overlay image index or state image index, you must specify the following masks in the stateMask member of the TVITEM structure. These values can also be used to mask off the state bits that are not of interest. TVIS_OVERLAYMASK
Mask for the bits used to specify the item's overlay image index.TVIS_STATEIMAGEMASK
Mask for the bits used to specify the item's state image index.TVIS_USERMASK