Posted on 1998-07-20
Last Modified: 2013-11-20
How do I set up the style for my TreeCtrl in a CTreeView?  I had MFC automatically generate a CTreeVIew for me, and I access the tree control using GetTreeCtrl(), but how do I set up the Tree's settings?

For example, I am wanting to have my tree control with the lines and the pluses besides the full nodes like the Windows Explorer.  Thanks!
Question by:mitchell042997
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 23

Accepted Solution

chensu earned 20 total points
ID: 1319471
After calling CTreeView::GetTreeCtrl, use CWnd::ModifyStyle to change the style because CTreeCtrl is derived from CWnd.

Author Comment

ID: 1319472
Could you give me a short line or two of example code?  Thanks!
LVL 23

Expert Comment

ID: 1319473
Something like this:

CTreeCtrl treeCtrl = this->GetTreeCtrl();
treeCtrl.ModifyStyle(0, TVS_HASLINES, SWP_SHOWWINDOW);

Author Comment

ID: 1319474
Thank you for your time!

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Define unique primary key 9 100
notReplace  challenge 53 153
Annoying "thing" blocks my view 4 146
Message not shown 5 104
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question