laeuchli
asked on
textout and \n
is there any way to use \n with textout?
Hi,
I don't think TextOut handles it. Why can't U go for DrawText(), as
CClientDC dc(this);
CRect rect(100,100,200,200);//so me rectangle
dc.DrawText("First\nSecond ", rect, DT_BOTTOM);
Try it out.
VinExpert
I don't think TextOut handles it. Why can't U go for DrawText(), as
CClientDC dc(this);
CRect rect(100,100,200,200);//so
dc.DrawText("First\nSecond
Try it out.
VinExpert
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WOW! VinExpert - I just gave your code
a try and it worked perfect!
a try and it worked perfect!
Hi GlennDean,
Thanks for Ur try. I knew it will work. But I am using DrawText(...) instead of TextOut(...). Ok?. (And I feel it is better under such conditions!!!)
VinExpert
Thanks for Ur try. I knew it will work. But I am using DrawText(...) instead of TextOut(...). Ok?. (And I feel it is better under such conditions!!!)
VinExpert
Hey VinExpert, but as far as I'm concerned DrawText is the way to go! I have never got TextOut to do what he wants. AND, on top of that, DrawText seems to be a "better version" of TextOut.
I'm embarrashed to admit but I have, for so long done the 'ol
"Text out at x,y"
"recompute x via the info in TEXTMETRIC"
"Text out at x,y"
I will put your "technique" in my memory banks for future use.
Thank-you very much,
Glenn
I'm embarrashed to admit but I have, for so long done the 'ol
"Text out at x,y"
"recompute x via the info in TEXTMETRIC"
"Text out at x,y"
I will put your "technique" in my memory banks for future use.
Thank-you very much,
Glenn
Hi Glenn,
Yes, U R right. DrawText(...) is the best way to use.
U R welcome.
VinExpert
Yes, U R right. DrawText(...) is the best way to use.
U R welcome.
VinExpert
ASKER
ok, I do this. However after that there is a problem. It won't print. Can you tell me what I can do to get it to print? I have mfc wizard code embeded.
Hi,
> It won't print
U want it to print on to the printer?. Then put the code in the OnDraw() as
CRect rect(100,100,800,800);
pDC->DrawText("ABC\nXYZ", rect, DT_BOTTOM);
Try it out.
VinExpert
> It won't print
U want it to print on to the printer?. Then put the code in the OnDraw() as
CRect rect(100,100,800,800);
pDC->DrawText("ABC\nXYZ", rect, DT_BOTTOM);
Try it out.
VinExpert
pDC->TextOut(0,0,"Eagles\n
or
pDC->TextOut(0,0,"ZZTop\\n
only to have the first display a vertical line and the second to display a \n