Solved

CListBox, Ownerdrawvariable and wordwrap

Posted on 1997-11-13
2
362 Views
Last Modified: 2013-11-19
I am trying to make a CListBox that wordwraps the text instead of using the horiz scrollbar.  I was told that I need to make it ONWERDRAWVARIABLE and use CDC to draw the text in to each by hand.  Does anyone have any sample code that demonstrates this?

0
Comment
Question by:yacht
  • 2
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1309928
Yes, you will need to use an ownerdrawn listbox. Then you will need to respond to two additional messages: OnMeasureItem() and OnDrawItem(). In OnMeasureItem, you will be asked to return the size of the item. That means you'll have to have figured out tall each item is going to be (since you'll use the width of the listbox for the width of the itme). You can use DrawText() with DT_WORDWRAP and DT_CALCRECT to figure out the size.

Then in DrawItem, you will need to draw the item with DrawText and specify DT_WORDWRAP.
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1309929
Oops. I meant DT_WORDBREAK and not DT_WORDWRAP.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 66
unable to delete all specified values regedit 38 549
sumHeights  challenge 17 74
Problem to App source 6 71
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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