-
March 12th, 2007, 03:54 PM
#1
MFC Printing from Bottom to Top (vertically) how to?
I'm looking to use MFC's DrawText or other API to print text on the left side of a graph vertically from bottom to top (90 degrees turn). I'm finding little help for it on the web. This can be done in .NET 2.0, but haven't found a way in MFC C++. Any help?
-
March 12th, 2007, 04:50 PM
#2
Re: MFC Printing from Bottom to Top (vertically) how to?
Before drawing the text, select in the device context a font with desired "escapement".
Here is an example:
Code:
void CMyCoolView::OnDraw(CDC* pDC)
{
// ...
CFont font;
LONG lfHeight = -::MulDiv(14, ::GetDeviceCaps(pDC->m_hDC, LOGPIXELSY), 72);
LONG lfEscapement = 900;
font.CreateFont(lfHeight,
0,
lfEscapement, // Escapement
0, // Orientation
FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
FF_ROMAN|DEFAULT_PITCH, _T("Times New Roman"));
CFont* pOldFont = pDC->SelectObject(&font);
pDC->TextOut(50, 150, CString(_T("Baba Safta")));
pDC->SelectObject(pOldFont);
}
Fore more info about font escapement and orientation take a look at LOGFONT strucure documentation in MSDN.
-
March 13th, 2007, 12:52 PM
#3
Re: MFC Printing from Bottom to Top (vertically) how to?
Great posting. This worked well. Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|