CTreeCtrl::Create
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
返回值
Nonzero if initialization was successful; otherwise 0.
如果初始化成功則返回非零值;否則返回0
參數說明
dwStyle
Specifies the tree view control’s style. Apply any combination of tree view control styles to the control.
指定tree view控件的風格??梢詫@個控件使用tree view控件風格的任意組合。
rect
Specifies the tree view control’s size and position. It can be either a CRect object or a RECT structure.
指定tree view控件的尺寸和位置。此參數可以是一個CRect對象或一個RECT結構。
pParentWnd
Specifies the tree view control’s parent window, usually a CDialog. It must not be NULL.
指定tree view控件的父窗口,通常是一個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.
構造一個CTreeCtrl要分兩步。首先調用構造函數,然后調用Create來創建這個tree view控件并將它與該CTeeCtrl對象連接
The following styles can be applied to a tree view control:
下面的風格可以應用到一個tree view控件
- TVS_HASLINES The tree view control has lines linking child items to their corresponding parent items.
TVS_HASLINES tree view控件的子項與它們的父項之間用線連接。 - TVS_LINESATROOT The tree view control has lines linking child items to the root of the hierarchy.
TVS_LINESATROOT tree view控件用線連接子項和根項。 - TVS_HASBUTTONS The tree view control adds a button to the left of each parent item.
TVS_HASBUTTONS tree view在每一個父項的左邊添加一個按鈕。 - TVS_EDITLABELS The tree view control allows the user to edit the labels of tree view items.
TVS_EDITLABELS tree view控件允許用戶編輯tree view項的標簽。 - TVS_SHOWSELALWAYS Causes a selected item to remain selected when the tree-view control loses focus.
TVS_SHOWSELALWAYS 當tree view失去焦點時,使被選擇的項仍然保持被選擇 - TVS_DISABLEDRAGDROP The tree-view control is prevented from sending TVN_BEGINDRAG notification messages.
TVS_DISABLEDRAGDROP 該tree view控件被禁止發送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 當使用這個風格時,改變在tree view中的選擇將導致正被選擇的項展開,而沒有被選擇的項收縮。如果用鼠標單擊被選擇的項,并且該項是關閉的,則該項就會展開。如果該被選擇的項被單擊時是打開的,則它就會收縮。