?
Solved

Two lined CTreeCtrl item

Posted on 1998-12-03
1
Medium Priority
?
494 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
[X]
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
1 Comment
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 680 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

770 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