CTreeCtrl::Create
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
返回值
Nonzero if initialization was successful; otherwise 0.
如果初始化成功則返回非零值;否則返回0
參數(shù)說(shuō)明
dwStyle
Specifies the tree view control’s style. Apply any combination of tree view control styles to the control.
指定tree view控件的風(fēng)格。可以對(duì)這個(gè)控件使用tree view控件風(fēng)格的任意組合。
rect
Specifies the tree view control’s size and position. It can be either a CRect object or a RECT structure.
指定tree view控件的尺寸和位置。此參數(shù)可以是一個(gè)CRect對(duì)象或一個(gè)RECT結(jié)構(gòu)。
pParentWnd
Specifies the tree view control’s parent window, usually a CDialog. It must not be NULL.
指定tree view控件的父窗口,通常是一個(gè)CDialog。它不能是NULL。
nID
Specifies the tree view control’s ID.
指定tree view控件的ID。
備注
If you specify the tree control in a dialog box template, or if you are using CTreeView, your tree control is created automatically when the dialog box or view is created. If you want to create the tree control as a child window of some other window, use the Create member function. If you create the tree control using Create, you must pass it WS_VISIBLE, in addition to other tree view styles.
You construct a CTreeCtrl in two steps. First call the constructor, then call Create, which creates the tree view control and attaches it to the CTreeCtrl object.
構(gòu)造一個(gè)CTreeCtrl要分兩步。首先調(diào)用構(gòu)造函數(shù),然后調(diào)用Create來(lái)創(chuàng)建這個(gè)tree view控件并將它與該CTeeCtrl對(duì)象連接
The following styles can be applied to a tree view control:
下面的風(fēng)格可以應(yīng)用到一個(gè)tree view控件
- TVS_HASLINES The tree view control has lines linking child items to their corresponding parent items.
TVS_HASLINES tree view控件的子項(xiàng)與它們的父項(xiàng)之間用線連接。 - TVS_LINESATROOT The tree view control has lines linking child items to the root of the hierarchy.
TVS_LINESATROOT tree view控件用線連接子項(xiàng)和根項(xiàng)。 - TVS_HASBUTTONS The tree view control adds a button to the left of each parent item.
TVS_HASBUTTONS tree view在每一個(gè)父項(xiàng)的左邊添加一個(gè)按鈕。 - TVS_EDITLABELS The tree view control allows the user to edit the labels of tree view items.
TVS_EDITLABELS tree view控件允許用戶編輯tree view項(xiàng)的標(biāo)簽。 - TVS_SHOWSELALWAYS Causes a selected item to remain selected when the tree-view control loses focus.
TVS_SHOWSELALWAYS 當(dāng)tree view失去焦點(diǎn)時(shí),使被選擇的項(xiàng)仍然保持被選擇 - TVS_DISABLEDRAGDROP The tree-view control is prevented from sending TVN_BEGINDRAG notification messages.
TVS_DISABLEDRAGDROP 該tree view控件被禁止發(fā)送TVN_BEGINDRAG通知消息。 - TVS_NOTOOLTIPS The tree view control uses no tooltips.
TVS_NOTOOLTIPS tree view控件使用工具提示。 - TVS_SINGLEEXPAND When this style is enabled, changing the selection in the tree view will automatically cause the item being selected to expand and the item being unselected to collapse. If the mouse is used to single-click the selected item and that item is closed, it will be expanded. If the selected item is single-clicked when it is open, it will be collapsed.
TVS_SINGLEEXPAND 當(dāng)使用這個(gè)風(fēng)格時(shí),改變?cè)趖ree view中的選擇將導(dǎo)致正被選擇的項(xiàng)展開(kāi),而沒(méi)有被選擇的項(xiàng)收縮。如果用鼠標(biāo)單擊被選擇的項(xiàng),并且該項(xiàng)是關(guān)閉的,則該項(xiàng)就會(huì)展開(kāi)。如果該被選擇的項(xiàng)被單擊時(shí)是打開(kāi)的,則它就會(huì)收縮。