Solved

Can not get CDC::TextOut() to draw multi-line

Posted on 1998-10-10
1
2,020 Views
Last Modified: 2013-11-20
I am using CDC::TextOut successfully to draw text to the screen but I can not seem to get it to draw in word-wrap mode.

Every time I try to use ExtTextOut or DrawText it always draws blank.

Any thoughts as to how to or whether this can be achieved?
0
Comment
Question by:rascal
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1323171
TextOut doesn't do  word breaks

pDC->DrawText( strText, &rectTextBody, DT_NOPREFIX | DT_LEFT | DT_TOP | DT_WORDBREAK ) ;

where rectTextBody is the rectangle
strText is the text, lines separated with CR/LF pair e.g. "Hello\r\nWorld"

DT_NOPREFIX is optional, but means & are displayed as &, rather than underlining the next char

If you are still getting blank, check the color of the text is different from the background - before calling DrawText

pDC->SetText( RGB(0,0,0) ) ; // black text
pDC->SetBkColor( RGB(255,255,255) ) ; // white background

The background for the text is either filled in with the background color (OPAQUE mode)or left as it is (TRANSPARENT mode) - again set this before calling DrawText

pDC->SetBkMode( TRANSPARENT ) ; // transparent background#
or
pDC->SetBkMode( OPAQUE) ; // opaque background

Make sure the rectangle you use in DrawText is big enough


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

Title # Comments Views Activity
unable to delete all specified values regedit 38 283
matchUp  challenge 6 53
matchUp  challenge 9 94
Use of condition with 'serial' in ansible 2 50
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: 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…
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

862 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

24 Experts available now in Live!

Get 1:1 Help Now