Solved

CListBox, Ownerdrawvariable and wordwrap

Posted on 1997-11-13
2
360 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now