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); }
CFormatBar::CFormatBar() { CFont fnt; fnt.Attach(GetStockObject(theApp.m_nDefFont)); m_szBaseUnits = GetBaseUnits(&fnt); CLocalComboBox::m_nFontHeight = m_szBaseUnits.cy; }
CFont& GraphicsMisc::Marlett() { static CFont font; if (!font.GetSafeHandle()) font.Attach(CreateFont(_T("Marlett"), -1, GMFS_SYMBOL)); return font; }
CFont& GraphicsMisc::WingDings() { static CFont font; if (!font.GetSafeHandle()) font.Attach(CreateFont(_T("Wingdings"), -1, GMFS_SYMBOL)); return font; }
BOOL CPOwnerDrawMenu::SetFont (HFONT hFont) { BOOL b; CFont Font; if (Font.Attach (hFont) != FALSE) { b = SetFont (Font); Font.Detach (); return b; } return FALSE; }
/** 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; }
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; }
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, "Ìæ»»"); }
BOOL GraphicsMisc::CreateFont(CFont& font, LPCTSTR szFaceName, int nPoint, DWORD dwFlags) { VerifyDeleteObject(font); return font.Attach(CreateFont(szFaceName, nPoint, dwFlags)); }
BOOL GraphicsMisc::CreateFont(CFont& fontOut, HFONT fontIn, DWORD dwFlags, DWORD dwMask) { VerifyDeleteObject(fontOut); return fontOut.Attach(CreateFont(fontIn, dwFlags, dwMask)); }