091115(星期天)CTreeCtrl::Create

 

1115

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.

 

virtual BOOL Create(

   DWORD dwStyle,

   const RECT& rect,

   CWnd* pParentWnd,

   UINT nID

);

Parameters

dwStyle

Specifies the tree view control's style. Apply window styles, described in CreateWindow, and any combination of tree view control styles as described in the Platform SDK.

rect

Specifies the tree view control's size and position. It can be either a CRect object or a RECT structure.

pParentWnd

Specifies the tree view control's parent window, usually a CDialog. It must not be NULL.

nID

Specifies the tree view control's ID.

Return Value

Nonzero if initialization was successful; otherwise 0.

 

Remarks

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.

 

To create a tree control with extended window styles, call CreateEx instead of Create.

 

Example

// Assuming your window has a CTreeCtrl member named m_TreeCtrl,

// you can create the tree control window with a child ID of 0x1005

// using a call like this:

 

m_TreeCtrl->Create(WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER

   | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_HASLINES

   | TVS_DISABLEDRAGDROP,

   CRect(10, 10, 300, 100), this, 0x1005);

 

// The control will have the appropiate window styles, and the tree

// control styles specified are those most commonly used.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值