Solved

Two lined CTreeCtrl item

Posted on 1998-12-03
1
481 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 79
no14 challenge 14 71
wait notify demo infinite loop 3 124
Detect file exist or not 3 179
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

860 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