BOOL CMyTreeView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style|=TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_EDITLABELS;
cs.style|=TVS_SHOWSELALWAYS;
return CTreeView::PreCreateWindow(cs);
}
CTreeCtrl::Create
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
Return Value
Nonzero if initialization was successful; otherwise 0.
Parameters
dwStyle
Specifies the tree view control’s style. Apply any combination of tree view control styles to the control.
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.
Remarks
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.
The following styles can be applied to a tree view control:
TVS_HASLINES The tree view control has lines linking child items to their corresponding parent items.
TVS_LINESATROOT The tree view control has lines linking child items to the root of the hierarchy.
TVS_HASBUTTONS The tree view control adds a button to the left of each parent item.
TVS_EDITLABELS The tree view control allows the user to edit the labels of tree view items.
TVS_SHOWSELALWAYS Causes a selected item to remain selected when the tree-view control loses focus.
TVS_DISABLEDRAGDROP The tree-view control is prevented from sending TVN_BEGINDRAG notification messages.
TVS_NOTOOLTIPS The tree view control uses no tooltips.
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.
CTreeCtrl Overview | Class Members | Hierarchy Chart
See Also CTreeCtrl::CTreeCtrl,
[Reference] : WhiteAT, 「C/C++/MFC - TreeView에서포커스를잃어도선택된거보이게」 http://whiteat.com/?mid=WhiteAT_c&document_srl=3261&sort_index=nick_name&order_type=asc&page=1.
'SoftWare_API_MFC' 카테고리의 다른 글
MFC 이미지 회전시키기(각도 조절) (0) | 2020.12.01 |
---|---|
atlimage.h를 include해도 CImage를 사용할 수 없는 경우? (0) | 2020.09.18 |
OnEraseBkgnd() 배경화면(Image bmp) & 속도 향상 (0) | 2020.02.28 |
C++ MFC Tip (0) | 2020.02.26 |
MFC 콘솔 디버깅 (0) | 2020.01.03 |