靜態創建的控制元件請問默認是雙擊加號減號然后折疊和展開嗎?
我現在的控制元件單擊就可以折疊展開,而且是亂的,請問該問題該如何解決。
如何回歸到默認狀態。
uj5u.com熱心網友回復:
需求:已經獲取一個樹,不對樹做任何修改,只添加check box檢查哪些選中。
然后查看了下默認雙擊折疊打開就行了
應該怎么弄?
uj5u.com熱心網友回復:
資源添加 TVS_CHECKBOXES 風格 既有CheckBox復選框MSDN 上的例子
/*
Working with state image indexes
There is often confusion about how to set and retrieve the state image index in a tree view control. The following examples demonstrate the proper method for setting and retrieving the state image index. The examples assume that there are only two state image indexes in the tree view control, unchecked and checked. If your application contains more than two, these functions will need to be modified to handle that case.
The following example function illustrates how to set an item's check state.
*/
BOOL TreeView_SetCheckState(HWND hwndTreeView, HTREEITEM hItem, BOOL fCheck)
{
TVITEM tvItem;
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
tvItem.hItem = hItem;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
/*
Since state images are one-based, 1 in this macro turns the check off, and
2 turns it on.
*/
tvItem.state = INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1));
return TreeView_SetItem(hwndTreeView, &tvItem);
}
The following example function illustrates how to retrieve an item's check state.
BOOL TreeView_GetCheckState(HWND hwndTreeView, HTREEITEM hItem)
{
TVITEM tvItem;
// Prepare to receive the desired information.
tvItem.mask = TVIF_HANDLE | TVIF_STATE;
tvItem.hItem = hItem;
tvItem.stateMask = TVIS_STATEIMAGEMASK;
// Request the information.
TreeView_GetItem(hwndTreeView, &tvItem);
// Return zero if it's not checked, or nonzero otherwise.
return ((BOOL)(tvItem.state >> 12) -1);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/81932.html
標籤:界面
