本文整理汇总了C++中CFont::CreateStockObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::CreateStockObject方法的具体用法?C++ CFont::CreateStockObject怎么用?C++ CFont::CreateStockObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::CreateStockObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitialUpdate
void CSListView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// SetColumn
ResetColumns( );
// Create Tab
if( !::IsWindow( m_wndWorkTab.GetSafeHwnd() )
&& m_wndWorkTab.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), this, IDC_SLISTVIEW_WORKTAB) )
{
CString strName;
strName.LoadString( IDS_SLISTVIEW_CLASS );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_CLASS);
strName.LoadString(IDS_SLISTVIEW_NQ);
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_NQ);
strName.LoadString( IDS_SLISTVIEW_A );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_A);
strName.LoadString( IDS_SLISTVIEW_SZNB );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_SZNB);
strName.LoadString( IDS_SLISTVIEW_SHB );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_SHB);
strName.LoadString( IDS_SLISTVIEW_BOND );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_BOND);
strName.LoadString( IDS_SLISTVIEW_FUND );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_FUND);
strName.LoadString( IDS_SLISTVIEW_SELF );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_SELF);
strName.LoadString( IDS_SLISTVIEW_GROUP );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_GROUP);
strName.LoadString( IDS_SLISTVIEW_DOMAIN );
m_wndWorkTab.Addtab( &m_Grid, strName, SL_WORKTAB_DOMAIN);
m_wndWorkTab.SetSelectTabColor( AfxGetProfile().GetColor(CColorClass::clrSListBK),
AfxGetProfile().GetColor(CColorClass::clrTitle) );
m_wndWorkTab.SetActualTitle(FALSE);
m_wndWorkTab.SetCurtab( SL_WORKTAB_SELF );
CFont font;
font.CreateStockObject (DEFAULT_GUI_FONT);
m_wndWorkTab.SetFont( &font );
// m_Grid No HScrollBar
m_Grid.SetOuterHScrollBar( TRUE, m_wndWorkTab.GetSafeHwnd() );
}
}
示例2: DrawLabel
void CIVInfoLabel::DrawLabel(CDC & dcTarget)
{
CRect rc;
GetClientRect (&rc);
CDC dc;
dc.CreateCompatibleDC (&dcTarget);
CBitmap bmp;
bmp.CreateCompatibleBitmap (&dcTarget, rc.Width(), rc.Height());
dc.SelectObject (&bmp);
CBrush brush;
brush.CreateSysColorBrush (COLOR_3DFACE);
dc.SelectObject (&brush);
dc.PatBlt (0,0, rc.Width(), rc.Height(), PATCOPY);
CFont font;
font.CreateStockObject (DEFAULT_GUI_FONT);
dc.SelectObject (&font);
dc.SetBkColor ( GetSysColor (COLOR_3DFACE));
dc.SetTextColor ( GetSysColor (COLOR_WINDOWTEXT));
CRect rcCalc = rc;
LPTSTR szStr = (LPTSTR) (LPCTSTR) m_strText;
DrawTextEx (dc, szStr, -1, &rcCalc, DT_CALCRECT | DT_CENTER | DT_WORDBREAK, NULL);
int nOffset = rcCalc.Height() < rc.Height()
? ( rc.Height() - rcCalc.Height() ) / 2 : 0;
rcCalc = rc;
rcCalc.top += nOffset;
DrawTextEx (dc, szStr, -1, &rcCalc, DT_CENTER | DT_WORDBREAK, NULL);
dcTarget.BitBlt(rc.left,rc.top,rc.Width(),rc.Height(),&dc,0,0,SRCCOPY);
}
示例3: OnCreate
int CMusikSourcesCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if ( CMusikPropTree::OnCreate(lpCreateStruct) == -1 )
return -1;
if ( m_DropTarget )
m_DropTarget->Register( this );
// edit in place
m_EditInPlace.Create( WS_CHILD, CRect( 0, 0, 0, 0 ), this, 123 );
CFont font;
font.CreateStockObject( DEFAULT_GUI_FONT );
m_EditInPlace.SetFont( &font );
InitItems();
return 0;
}
示例4: OnInitDialog
BOOL CLoungeDlg::OnInitDialog()
{
VERIFY(radioBtnOn_.LoadBitmap(IDB_RADIO_ON, IDB_RADIOMASK));
VERIFY(radioBtnOff_.LoadBitmap(IDB_RADIO_OFF, IDB_RADIOMASK));
CDialog::OnInitDialog();
CFont f;
f.CreateStockObject(DEFAULT_GUI_FONT);
LOGFONT lf;
f.GetLogFont(&lf);
if (lf.lfHeight > 0)
lf.lfHeight += 2;
else
lf.lfHeight -= 2;
font_.CreateFontIndirect(&lf);
GetDlgItem(IDC_LD_RADIO1)->SetFont(&font_);
GetDlgItem(IDC_LD_RADIO2)->SetFont(&font_);
CDC dc;
dc.CreateCompatibleDC(NULL);
CRect r;
GetDlgItem(IDC_LD_RADIO1)->GetWindowRect(&r);
ScreenToClient(&r);
rectRadio1_ = r;
CFont* pOldFont = dc.SelectObject(&font_);
Base::DrawBumpText(&dc, g_szViewByWaitingLists,
rectRadio1_, DT_CALCRECT,
0, 0);
rectRadio1_.right += 16;
radioYOffset_ = rectRadio1_.Height() - r.Height();
GetDlgItem(IDC_LD_RADIO2)->GetWindowRect(&r);
ScreenToClient(&r);
rectRadio2_ = r;
Base::DrawBumpText(&dc, g_szViewByTables,
rectRadio2_, DT_CALCRECT,
0, 0);
rectRadio2_.right += 16;
dc.SelectObject(pOldFont);
GetDlgItem(IDC_LD_RADIO1)->GetWindowRect(&r);
ScreenToClient(&r);
GetDlgItem(IDC_LD_RADIO2)->GetWindowRect(&r);
ScreenToClient(&r);
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
addInitialData();
pDetailsDlg_ = new CTableDetailsDlg(this);
if (pDetailsDlg_)
if (!pDetailsDlg_->Create(IDD_TABLEDETAILS, this))
{
TRACE0("Failed to create table details window\n");
}
pTournamentDlg_ = new CTournamentDetailsDlg(this);
if (pTournamentDlg_)
if (!pTournamentDlg_->Create(IDD_TOURNAMENTDETAILS, this))
{
TRACE0("Failed to create tourmanet details window\n");
}
pChatDlg_ = new CChatDlg(this);
if (pChatDlg_)
if (!pChatDlg_->Create(NULL, NULL, WS_CHILD|WS_VISIBLE, CFrameWnd::rectDefault, this, IDD_CHAT))
{
TRACE0("Failed to create chat window\n");
}
restoreSettings();
// Begin with the splash screen
PostMessage(WM_COMMAND,
MAKEWPARAM(ID_SHOW_SPLASH,0), 0);
//setBannerText("Testing Testing 1 2 3...", 0);
//.........这里部分代码省略.........
示例5: UpdateFonts
//.........这里部分代码省略.........
fontRegular.CreateFontIndirect(&lf);
// Create small font:
LONG lfHeightSaved = lf.lfHeight;
lf.lfHeight = (long)((1. + abs(lf.lfHeight)) * 2 / 3);
if (lfHeightSaved < 0)
{
lf.lfHeight = -lf.lfHeight;
}
fontSmall.CreateFontIndirect(&lf);
lf.lfHeight = lfHeightSaved;
// Create tooltip font:
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(ncm);
GetNonClientMetrics (ncm);
lf.lfItalic = ncm.lfStatusFont.lfItalic;
lf.lfWeight = ncm.lfStatusFont.lfWeight;
fontTooltip.CreateFontIndirect(&lf);
lf.lfItalic = info.lfMenuFont.lfItalic;
lf.lfWeight = info.lfMenuFont.lfWeight;
// Create "underline" font:
lf.lfUnderline = TRUE;
fontUnderline.CreateFontIndirect(&lf);
lf.lfUnderline = FALSE;
// Create bold font:
lf.lfWeight = FW_BOLD;
fontBold.CreateFontIndirect(&lf);
// Create Marlett font:
BYTE bCharSet = lf.lfCharSet;
lf.lfWeight = info.lfMenuFont.lfWeight;
lf.lfCharSet = SYMBOL_CHARSET;
lf.lfWeight = 0;
lf.lfHeight = ::GetSystemMetrics(SM_CYMENUCHECK) - 1;
lstrcpy(lf.lfFaceName, AFX_FONT_NAME_MARLETT);
fontMarlett.CreateFontIndirect(&lf);
lf.lfCharSet = bCharSet; // Restore charset
// Create vertical font:
CFont font;
if (font.CreateStockObject(DEFAULT_GUI_FONT))
{
if (font.GetLogFont(&lf) != 0)
{
lf.lfOrientation = 900;
lf.lfEscapement = 2700;
lf.lfHeight = info.lfMenuFont.lfHeight;
lf.lfWeight = info.lfMenuFont.lfWeight;
lf.lfItalic = info.lfMenuFont.lfItalic;
{
lstrcpy(lf.lfFaceName, AFX_FONT_NAME_VERT);
}
fontVert.CreateFontIndirect(&lf);
lf.lfEscapement = 900;
fontVertCaption.CreateFontIndirect(&lf);
}
}
// Create dialog underline and bold fonts:
CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
ASSERT_VALID(pDefaultGUIFont);
pDefaultGUIFont->GetLogFont(&lf);
lf.lfUnderline = TRUE;
fontDefaultGUIUnderline.CreateFontIndirect(&lf);
lf.lfUnderline = FALSE;
lf.lfWeight = FW_BOLD;
fontDefaultGUIBold.CreateFontIndirect(&lf);
UpdateTextMetrics();
#if 0
// Notify toolbars about font changing:
for (POSITION posTlb = afxAllToolBars.GetHeadPosition(); posTlb != NULL;)
{
CMFCToolBar* pToolBar = (CMFCToolBar*) afxAllToolBars.GetNext(posTlb);
ENSURE(pToolBar != NULL);
if (CWnd::FromHandlePermanent(pToolBar->m_hWnd) != NULL)
{
ASSERT_VALID(pToolBar);
pToolBar->OnGlobalFontsChanged();
}
}
#endif
}