CDC::TextOut (or ExtTextOut) background colour troubles  
Author Message
achinj





PostPosted: Tue Sep 20 03:49:38 CDT 2005 Top

MFC >> CDC::TextOut (or ExtTextOut) background colour troubles Hi. I'm displaying some text on a dialog.

CPaintDC dc(this);
dc.TextOut(rect.left,rect.top,"HELLO");

On initial drawing of the dialog, the text background is white. As soon as a
control is used, the text background goes grey. Any way to make this not
change (or set to one colour)?

Visual Studio29  
 
 
Asko





PostPosted: Tue Sep 20 03:49:38 CDT 2005 Top

MFC >> CDC::TextOut (or ExtTextOut) background colour troubles Hamish wrote:
> Hi. I'm displaying some text on a dialog.
>
> CPaintDC dc(this);
> dc.TextOut(rect.left,rect.top,"HELLO");
>
> On initial drawing of the dialog, the text background is white. As soon as a
> control is used, the text background goes grey. Any way to make this not
> change (or set to one colour)?
>
>
>
>

If you want to draw transparent text, set back mode to transparent before
drawing text:

dc.SetBkMode(TRANSPARENT);
dc.TextOut(rect.left,rect.top,"HELLO");

Asko.
 
 
AliR





PostPosted: Tue Sep 20 10:18:26 CDT 2005 Top

MFC >> CDC::TextOut (or ExtTextOut) background colour troubles When you use TextOut or DrawText (DrawText is better) the text will get
drawn using the current Text Color, background color and background mode.

So before you call TextOut or DrawText call the following functions to
change these attributes.

dc.SetTextColor(...);
dc.SetBkColor(...);
dc.SetBkMode(..); //if you pass TRANSPARENT to this then you don't need
to set the bk color


AliR.

"Hamish" <EMail@HideDomain.com> wrote in message
news:oMLXe.13133$EMail@HideDomain.com...
> Hi. I'm displaying some text on a dialog.
>
> CPaintDC dc(this);
> dc.TextOut(rect.left,rect.top,"HELLO");
>
> On initial drawing of the dialog, the text background is white. As soon as
a
> control is used, the text background goes grey. Any way to make this not
> change (or set to one colour)?
>
>
>
>