Link to home
Start Free TrialLog in
Avatar of pipe
pipe

asked on

How to set font type and size using DrawText


Hello,
  Im using the following code to output text to the screen. However, I want to change the font to arial and make the size smaller. How can I go about doing this?

thanks,
  jer

CRect rect;
rect.top = 110;
rect.left = 0;
rect.bottom = 310;
rect.right = 300;

dc->SetTextColor( RGB( 255, 255, 255 ) );

dc->SetBkMode( TRANSPARENT );

dc->DrawText( "10:31pm", &rect, DT_CENTER );

ASKER CERTIFIED SOLUTION
Avatar of basant
basant

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
CFont fnt;
fnt.CreatePointFont(120, _T("Arial"));

CFont *pOldFont = dc->SelectObject(&fnt);

dc->DrawText( "10:31pm", &rect, DT_CENTER );

dc->SelectObject(pOldFont);
Avatar of pipe
pipe

ASKER

thanks both!