CDC中的竖排文本? 在OnDraw成员函数中我想让文本竖直对齐,但CDC类似乎不支持该处理 A:如果你的竖直对齐是指旋转文本的话,下面的代码会对你有帮助: 该代码检 查一个Check box控制,查看文本是否需要旋转. // m_pcfYTitle is a Cfont* to the selected font. // m_bTotateYTitle is a bool (==TRUE if rotated) void CPage1::OnRotateytitle() { LOGFONT lgf; m_pcfYTitle->GetLogFont(&lgf); m_bRotateYTitle= ((Cbutton*)GetDlgItem(IDC_ROTATEYTITLE))->GetCheck()>0; // escapement is reckoned clockwise in 1/10ths of a degree: lgf.lfEscapement=-(m_bRotateYTitle*900); m_pcfYTitle->DeleteObject(); m_pcfYTitle->CreateFontIndirect(&lgf); DrawSampleChart(); } 注意如果你从CFontDialog中选择了不同的字体,你应该自己设定LOGFONT的 lfEscapement成员.将初始化后的lfEscapement值传到CFontDialog中. A2:还有一段代码可参考: LOGFONT LocalLogFont; strcpy(LocalLogFont.lfFaceName, TypeFace); LocalLogFont.lfWeight = fWeight; LocalLogFont.lfEscapement = Orient; LocalLogFont.lfOrientation = Orient; if (MyFont.CreateFontIndirect(&LocalLogFont)) { cMyOldFont = cdc->SelectObject(&MyFont); }