Solved

CListBox, Ownerdrawvariable and wordwrap

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

17 Experts available now in Live!

Get 1:1 Help Now