TextOut of CDC
-
I am trying to write on a label. In the OnEraseBackground function I have
pDC->TextOut(50,42,"aaaa",30);
At this location I get a black rectangle. What do I need to do to see the text? thanks, sb
I do not know what foreground color, background color, drawing mode you are using, or if you are drawing at the right time because the code sample is missing detail. But the last parameter you have specified in your example is incorrect - it is supposed to be the character count of the specified string (note that the documentation may be incorrect when it says "byte count"). As such, you should be specifying
4
. Peace! -=- James
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
DeleteFXPFiles & CheckFavorites (Please rate this post!) -
I am trying to write on a label. In the OnEraseBackground function I have
pDC->TextOut(50,42,"aaaa",30);
At this location I get a black rectangle. What do I need to do to see the text? thanks, sb
As you are working with CDC you can simply set the text color using SetTextColor() API which takes COLORREF as parameter. The secret of life is not enjoyment but education through experience. - Swami Vivekananda.
-
I am trying to write on a label. In the OnEraseBackground function I have
pDC->TextOut(50,42,"aaaa",30);
At this location I get a black rectangle. What do I need to do to see the text? thanks, sb
wrote:
I am trying to write on a label.
Why you are trying
TextOut
on label ?? Simply useSetWindowText
for that label if using MFC. For win32 useSendMessage(handle,WM_SETTEXT,...);
Knock out 't' from can't, You can if you think you can :cool: -
I am trying to write on a label. In the OnEraseBackground function I have
pDC->TextOut(50,42,"aaaa",30);
At this location I get a black rectangle. What do I need to do to see the text? thanks, sb
Any particular reason why you are writing in the
OnEraseBackground()
method? Why not do it in theOnPaint()
method?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
Any particular reason why you are writing in the
OnEraseBackground()
method? Why not do it in theOnPaint()
method?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
Thats what I saw in a sample program, so I used OnEraseBackground. I did get TextOut to work , thanks everybody. I'm drawing on the label because I drew a histogram on it and want to put values for the tick marks on the axes. Maybe there is a smarter control to use instead ofa label? thanks sb
-
I am trying to write on a label. In the OnEraseBackground function I have
pDC->TextOut(50,42,"aaaa",30);
At this location I get a black rectangle. What do I need to do to see the text? thanks, sb
you can use WM_PAINT instead WM_ERASEBKGND
void CAnswer::OnPaint() { CPaintDC dc(this); dc.SetBkMode(0); dc.TextOut(50,42,"aaaa",30); }
_**
**_
whitesky