本文整理汇总了C++中CGumpEditorDoc::GetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ CGumpEditorDoc::GetFont方法的具体用法?C++ CGumpEditorDoc::GetFont怎么用?C++ CGumpEditorDoc::GetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGumpEditorDoc
的用法示例。
在下文中一共展示了CGumpEditorDoc::GetFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitDialog
BOOL CGumpStaticPropertyPage::OnInitDialog()
{
CDiagramPropertyPage::OnInitDialog();
m_btnColor.SetStyle(TRUE);
m_btnColor.SetTrackSelection(TRUE);
m_btnColor.SetDefaultText("");
CGumpEditorDoc* pDoc = GfxGetGumpDocument(); ASSERT(pDoc);
using namespace std;
CString strId;
for (vector<nConfig::font_info>::iterator iter=nConfig::fonts.begin(); iter != nConfig::fonts.end(); iter++)
{
if (!pDoc->GetFont(iter->id)) continue;
strId.Format("%d", iter->id);
m_cbFont.AddString(strId);
}
if (LB_ERR != m_cbFont.SetCurSel(3))
{
m_cbFont.GetLBText(m_cbFont.GetCurSel(), strId);
}
m_btnColor.SetFontId(GetFontId());
return TRUE;
}
示例2: OnPaint
void CGumpStaticPropertyPage::OnPaint()
{
CPaintDC dc(this);
CString strId;
int i = m_cbFont.GetCurSel();
m_cbFont.GetLBText(i, strId);
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
CFont* pOldFont = dc.SelectObject(pDoc->GetFont(GetFontId()));
COLORREF crOld = dc.SetTextColor(m_btnColor.GetColor());
dc.SetBkMode(TRANSPARENT);
CRect rect;
GetDlgItem(IDC_TEXT_STATIC)->GetWindowRect(rect);
ScreenToClient(rect);
rect.DeflateRect(5,0,0,5);
UINT nFormat[] = { DT_LEFT, DT_CENTER, DT_RIGHT };
UINT format = DT_VCENTER | nFormat[m_iTextAlign];
CString strText = m_strText;
if (!m_bMultiLine) {
format |= DT_SINGLELINE;
}
else {
// '\\n' -> '\r\n'
strText = GfxFormatText(strText);
}
dc.DrawText(strText, rect, format);
dc.SelectObject(pOldFont);
dc.SetTextColor(crOld);
}
示例3: Draw
void CGumpStatic::Draw( CDC* dc, CRect rect )
{
dc->SelectObject( CStdGrfx::dialogBrush() );
dc->SelectObject( CStdGrfx::dialogPen() );
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
ASSERT(pDoc);
//dc->Rectangle( rect );
//LOGFONT lf;
//CFont font;
//GetFont( lf );
//// MS Sans Serif will not scale below 8 pts
//if( GetZoom() < 1 )
// lstrcpy( lf.lfFaceName, _T( "Arial" ) );
//
//font.CreateFontIndirect( &lf );
CFont* pFont = pDoc->GetFont(m_fontId);
CFont* pOld = dc->SelectObject(pFont);
CString strText = GetTitle();
UINT align[] = { TA_LEFT, DT_CENTER, TA_RIGHT };
UINT format = DT_TOP | align[m_textAlign];
if (IsMultiLine()) {
strText = GfxFormatText(strText);
}
else {
format |= DT_SINGLELINE;
}
int oldMode = dc->SetBkMode( TRANSPARENT );
COLORREF color = pDoc->GetHueColor(m_hueId, m_fontId);
COLORREF oldColor = dc->SetTextColor(color);
dc->DrawText( strText, rect, format);
dc->SetBkMode(oldMode);
dc->SetTextColor(oldColor);
dc->SelectStockObject( ANSI_VAR_FONT );
dc->SelectStockObject( BLACK_PEN );
dc->SelectStockObject( WHITE_BRUSH );
}
示例4: GetTextExtend
CSize CGumpStatic::GetTextExtend() const
{
CGumpEditorDoc* pDoc = GfxGetGumpDocument();
ASSERT(pDoc);
CWnd* pWnd = AfxGetMainWnd(); //pDoc->FindView(RUNTIME_CLASS(CGumpEditorView));
CDC* pDC = pWnd->GetDC();
CFont* pFont = pDoc->GetFont(m_fontId);
CFont* pOld = pDC->SelectObject(pFont);
pDC->SelectObject(pFont);
CSize size = pDC->GetTextExtent(GetTitle());
pDC->SelectObject(pOld);
return size;
}