• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

How do I draw text on a CDC not horizontaly

Hello

I would like to know how to draw text
on a cdc specifying an orientation angle for the string.

0
Luciano110599
Asked:
Luciano110599
1 Solution
 
ZoppoCommented:
Hi Luciano,

You'll have to create a rotated font and select it into the dc, i.e.:

/*********************************************************************************/
CFont font, *pFont;
font.CreatePointFont( 300, "Times New Roman", pDC ); // size here 30 pts
LOGFONT lf;
font.GetLogFont( &lf );
font.DeleteObject();
lf.lfEscapement = lf.lfOrientation = -450; // angle 45° CCW
font.CreateFontIndirect( &lf );
pFont = pDC->SelectObject( &font );
pDC->TextOut( 100, 100, "HELLO, WORLD ........" );
pDC->SelectObject( pFont );
/*********************************************************************************/

hope that helps,

ZOPPO
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now