Solved

Two lined CTreeCtrl item

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Whole sheet autoscrub still needed 19 50
countEvens challenge 2 98
fizzArray  challenge 1 82
fizzArray2 challenge 1 79
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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