本文整理汇总了C++中CFont::Attach方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::Attach方法的具体用法?C++ CFont::Attach怎么用?C++ CFont::Attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::Attach方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDraw
void CCaptionView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
CRect rect;
GetClientRect(rect);
// Andere Backroundfarbe einstellen
CBrush Brush(GetSysColor(COLOR_BTNFACE));
CBrush *poldBrush = pDC -> SelectObject(&Brush);
// Anderen Font einstellen
CFont Font; Font.Attach ((HFONT)GetStockObject (ANSI_VAR_FONT));
CFont* pFontOld = pDC -> SelectObject(&Font);
Font.Detach();
// WindowRect füllen
pDC -> FillRect(rect, &Brush);
// Backroundfarbe für Text setzen
pDC -> SetBkColor(GetSysColor(COLOR_BTNFACE));
// Text setzen
pDC -> DrawText (m_strCaption, -1, rect,
DT_LEFT | DT_VCENTER | DT_SINGLELINE);
// Rücksetzen der alten Objekte
pDC -> SelectObject(&poldBrush);
pDC -> SelectObject(&pFontOld);
}
示例2: GetBaseUnits
CFormatBar::CFormatBar()
{
CFont fnt;
fnt.Attach(GetStockObject(theApp.m_nDefFont));
m_szBaseUnits = GetBaseUnits(&fnt);
CLocalComboBox::m_nFontHeight = m_szBaseUnits.cy;
}
示例3:
CFont& GraphicsMisc::Marlett()
{
static CFont font;
if (!font.GetSafeHandle())
font.Attach(CreateFont(_T("Marlett"), -1, GMFS_SYMBOL));
return font;
}
示例4: SetFont
BOOL CPOwnerDrawMenu::SetFont (HFONT hFont)
{
BOOL b;
CFont Font;
if (Font.Attach (hFont) != FALSE)
{
b = SetFont (Font);
Font.Detach ();
return b;
}
return FALSE;
}
示例5: GetStockObject
/** View 窗口创建
*
* \param lpCreateStruct
* \return
*/
int CResourceView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rectDummy;
rectDummy.SetRectEmpty();
// 创建视图:
const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;
if (!m_TabCtrl.Create(dwViewStyle, rectDummy, this, ID_TAB_RESOUCEVIEW))
{
return -1;
}
HGDIOBJ hFont = GetStockObject(DEFAULT_GUI_FONT);
CFont font;
font.Attach(hFont);
m_TabCtrl.SetFont(&font);
BOOL bNameValid = FALSE;
// load default resource tab page name
CString strDefaultResource;
bNameValid = strDefaultResource.LoadString(IDS_DEFAULT_RESOURCE);
ASSERT(bNameValid);
m_TabCtrl.InsertItem(0, strDefaultResource);
// create default tab page
if (!m_DefaultResourceListBox.Create(CSize(64,64), WS_CHILD|WS_VISIBLE,
rectDummy, &m_TabCtrl, ID_TAB_DEFAULT))
{
return -1;
}
// load default resource
m_DefaultResourceListBox.Load("D:\\sdk\\trunk\\OgreSDK\\Debug\\media\\terrain\\brush", "*.*");
m_DefaultResourceListBox.ShowWindow(SW_SHOW);
// set default page
m_TabCtrl.SetCurSel(0);
AdjustLayout();
return 0;
}
示例6: Create
BOOL COutputBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
CSize sizeDefault, BOOL bHasGripper, UINT nID,
DWORD dwStyle )
{
if(!CSizingControlBar::Create(lpszWindowName,pParentWnd,sizeDefault,bHasGripper,nID,dwStyle))
return FALSE;
DWORD richeditstyle = WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL
| ES_WANTRETURN | WS_TABSTOP | ES_READONLY;
VERIFY(m_EditCtrl.CreateEx(WS_EX_CLIENTEDGE,richeditstyle,CRect(0,0,0,0),this,ID_BOTEDIT));
HFONT hFont = (HFONT) (::GetStockObject(DEFAULT_GUI_FONT));
CFont font;
font.Attach(hFont);
m_EditCtrl.SetFont(&font);
return TRUE;
}
示例7: OnPaint
void TexturePopup::OnPaint()
{
CPaintDC dc(this); // device context for painting
if (!m_bAnimationIsDone && !CMFCToolBar::IsCustomizeMode ())
{
DrawFade (&dc);
}
else
{
DoPaint (&dc);
}
dc.FillSolidRect(mButtonRect, RGB(245,245,245));
// ±ß¿ò
CBrush brBtnShadow(GetSysColor(COLOR_BTNSHADOW));
dc.FrameRect(mButtonRect, &brBtnShadow);
// ÎÄ×Ö
CFont font;
font.Attach(::GetStockObject(DEFAULT_GUI_FONT));
dc.SelectObject(font);
dc.TextOut(20, 67, "Ìæ»»");
}
示例8: CreateFont
BOOL GraphicsMisc::CreateFont(CFont& font, LPCTSTR szFaceName, int nPoint, DWORD dwFlags)
{
VerifyDeleteObject(font);
return font.Attach(CreateFont(szFaceName, nPoint, dwFlags));
}