Solved

CListBox, Ownerdrawvariable and wordwrap

Posted on 1997-11-13
2
363 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
[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
  • 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 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