Solved

Two lined CTreeCtrl item

Posted on 1998-12-03
1
470 Views
Last Modified: 2013-11-20
I wish to display a tree control with each item having two lines of descriptive text.
I've tried using SetItemText with a newline character, but I just get a wierd char displyed:

SetItemText(HTREEITEM, "First line\nSecond line");

Does anyone know how I can have two lines of text on each item?
0
Comment
Question by:Gumpster
1 Comment
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 170 total points
ID: 1325716
The tree control does not automatically support multiple lines for the text. However, if you are using a newer version of the common controls: 4.71, then you can use a concept called custom draw. For more information about custom draw, search MSDN (www.microsoft.com/msdn) for custom draw.

Basically, when you insert an item into the tree control, you can specify how many default lines you want for the item. By default, this will be one. But, you can specify two to reserve two lines for use by a particular item.

But the control does not draw on the extra space. You have to do it yourself by using custom draw. Basically, you catch NM_CUSTOMDRAW and draw in the area yourself. So you would have to parse your strings and draw the text using DrawText() which allows you to draw on multiple lines by using DF_MULTILINE.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now