本文整理汇总了C++中CFont::DeleteObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::DeleteObject方法的具体用法?C++ CFont::DeleteObject怎么用?C++ CFont::DeleteObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::DeleteObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupAxes
// Set the axes and origin values.
void MyGraph::SetupAxes(CDC& dc)
{
VALIDATE;
ASSERT_VALID(&dc);
// Since pie has no axis lines, set to full size minus GAP_PIXELS on each
// side. These are needed for legend to plot itself.
if (MyGraph::PieChart == m_eGraphType) {
m_nXAxisWidth = m_rcGraph.Width() - (GAP_PIXELS * 2);
m_nYAxisHeight = m_rcGraph.Height() - m_rcTitle.bottom;
m_ptOrigin.x = GAP_PIXELS;
m_ptOrigin.y = m_rcGraph.Height() - GAP_PIXELS;
}
else {
// Bar and Line graphs.
// Need to find out how wide the biggest Y-axis tick label is
// Get and store height of axis label font.
m_nAxisLabelHeight = max(m_rcGraph.Height() / Y_AXIS_LABEL_DIVISOR, MIN_FONT_SIZE);
// Get and store height of tick label font.
m_nAxisTickLabelHeight = max(int(m_nAxisLabelHeight*0.8), MIN_FONT_SIZE);
CFont fontTickLabels;
VERIFY(fontTickLabels.CreatePointFont(m_nAxisTickLabelHeight, _T("Arial"), &dc));
// Select font and store the old.
CFont* pFontOld = dc.SelectObject(&fontTickLabels);
ASSERT_VALID(pFontOld);
// Obtain tick label dimensions.
CString sTickLabel;
sTickLabel.Format(_T("%d"), GetMaxDataValue());
CSize sizTickLabel(dc.GetTextExtent(sTickLabel));
// Set old font object again and delete temporary font object.
VERIFY(dc.SelectObject(pFontOld));
fontTickLabels.DeleteObject();
// Determine axis specifications.
m_ptOrigin.x = m_rcGraph.left + m_nAxisLabelHeight/10 + 2*GAP_PIXELS
+ sizTickLabel.cx + GAP_PIXELS + TICK_PIXELS;
m_ptOrigin.y = m_rcGraph.bottom - m_nAxisLabelHeight/10 - 2*GAP_PIXELS -
sizTickLabel.cy - GAP_PIXELS - TICK_PIXELS;
m_nYAxisHeight = m_ptOrigin.y - m_rcTitle.bottom - (2 * GAP_PIXELS);
m_nXAxisWidth = (m_rcGraph.Width() - GAP_PIXELS) - m_ptOrigin.x;
}
}
示例2: OnPaint
void CStackWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
CFont* pOldFont = dc.SelectObject(&m_Font);
pOldFont->DeleteObject();
RECT rc;
GetClientRect(&rc);
DWORD dwSelStart = std::min(m_dwSelStart,m_dwSelEnd);
DWORD dwSelEnd = std::max(m_dwSelStart,m_dwSelEnd);
for (int i=0;i*m_nLineHight<=rc.bottom;++i)
{
RECT tmp = rc;
tmp.top = i*m_nLineHight;
tmp.bottom = tmp.top + m_nLineHight;
DWORD data;
DWORD dwLineAddr = m_dwStartAddr+i*4;
SIZE_T nRead = 0;
if (dwLineAddr>=dwSelStart && dwLineAddr <=dwSelEnd)
{
dc.SetBkColor(0x00FF0000);
}
if (debug_kernel_ptr && debug_kernel_ptr->read_memory(dwLineAddr,&data,4,&nRead) && nRead == 4)
{
char line[20];
sprintf(line,"%08X %08X",dwLineAddr,data);
dc.ExtTextOut(0,i*m_nLineHight,ETO_OPAQUE,&tmp,line,17,NULL);
}
else
{
char line[20];
sprintf(line,"%08X ???",dwLineAddr);
dc.ExtTextOut(0,i*m_nLineHight,ETO_OPAQUE,&tmp,line,12,NULL);
}
dc.SetBkColor(0x00FFFFFF);
}
// 不为绘图消息调用 CWnd::OnPaint()
}
示例3: GetFontObject
CFont* CGridCell::GetFontObject() const
{
// If the default font is specified, use the default cell implementation
if (m_plfFont == nullptr)
{
const CGridDefaultCell* pDefaultCell = static_cast<const CGridDefaultCell*>(GetConstDefaultCell());
if (!pDefaultCell)
return nullptr;
return pDefaultCell->GetFontObject();
}
else
{
static CFont Font;
Font.DeleteObject();
Font.CreateFontIndirect(m_plfFont);
return &Font;
}
}
示例4: GetDefaultCell
CFont* Printing::CPntGridCell::GetFontObject( CDC* pDC /*= NULL*/ ) const
{
// If the default font is specified, use the default cell implementation
if (m_plfFont == NULL)
{
CPntGridDefaultCell *pDefaultCell = (CPntGridDefaultCell*) GetDefaultCell();
if (!pDefaultCell)
return NULL;
return pDefaultCell->GetFontObject();
}
else
{
static CFont Font;
Font.DeleteObject();
Font.CreatePointFont(m_plfFont->lfHeight, m_plfFont->lfFaceName, pDC);
return &Font;
}
}
示例5: GetFontObject
CFont* CGridCell::GetFontObject() const
{
// If the default font is specified, use the default cell implementation
if (m_plfFont == NULL)
{
CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell();
if (!pDefaultCell)
return NULL;
return pDefaultCell->GetFontObject();
}
else
{
static CFont Font;
Font.DeleteObject();
Font.CreateFontIndirect(m_plfFont);
return &Font;
}
}
示例6: Draw
void MenuItemSprite::Draw(HDC hDC)
{
if(m_pBitmap&&!m_bHidden)
{
m_pBitmap->DrawPart(hDC,m_rcPosition.left,m_rcPosition.top,0,m_iCurFrame*GetHeight(),GetWidth(),GetHeight(),FALSE);
if(m_iCurFrame==7&&m_bWithText)
{
int oldMode;
COLORREF oldColor;
CFont cf;
cf.CreateFont(
19, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"���ו");
HFONT oldFont=(HFONT)SelectObject(hDC,cf.m_hObject);
oldColor=SetTextColor(hDC,RGB(252,252,56));
oldMode=SetBkMode(hDC,TRANSPARENT);
RECT rt=m_rcPosition;
rt.left-=4;rt.right-=4;
rt.top++;rt.bottom++;
DrawText(hDC,m_strText,-1,&rt,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
SelectObject(hDC,oldFont);
cf.DeleteObject();
SetTextColor(hDC,oldColor);
SetBkMode(hDC,oldMode);
}
}
}
示例7: InitGridContent
BOOL CNineShowView::InitGridContent(CNineGridCtrl *pGrid )
{
m_nCols=4;
m_nFixRows=1;
m_nFixCols=0;
m_nRows=20;
try {
pGrid->SetRowCount(m_nRows);
pGrid->SetColumnCount(m_nCols);
pGrid->SetFixedRowCount(m_nFixRows);
pGrid->SetFixedColumnCount(m_nFixCols);
}
catch (CMemoryException* e)
{
e->ReportError();
e->Delete();
return FALSE;
}
pGrid->SetGridColor(m_pDoc->m_colorArray[18],m_pDoc->m_colorArray[17],m_pDoc->m_colorArray[16]);
//20000615
pGrid->SetFixedBkColor(m_pDoc->m_colorArray[18]);
//20000615
CFont Font;
LOGFONT m_lf;
memset(&m_lf,0,sizeof(LOGFONT));
m_lf.lfHeight = -12;
m_lf.lfWidth=0;
m_lf.lfWeight=400;
m_lf.lfCharSet=134;
strcpy(m_lf.lfFaceName,"宋体");
Font.CreateFontIndirect(&m_lf);
pGrid->SetFont(&Font);
Font.DeleteObject();
return TRUE;
}
示例8: SetNewFont
void CMainDialog::SetNewFont()
{
CFont font;
font.CreateFont(m_height, 0, 0, 0, m_weight, FALSE, FALSE, FALSE, DEFAULT_CHARSET /*ANSI_CHARSET*/,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS /*FF_DONTCARE*/, m_facename.GetBuffer(0));
m_example_text.SetFont(&font, TRUE);
#ifdef _DEBUG
{
LOGFONT lf;
font.GetLogFont(&lf);
TRACE(" Typeface = %s\n", lf.lfFaceName);
TRACE(" Charset = %d\n", lf.lfCharSet);
}
#endif
font.DeleteObject();
}
示例9: AfxSelectDCFont
CFont * AfxSelectDCFont( CDC * pDC, int nHeight )
{
static CFont font;
font.DeleteObject();
#ifdef CLKLAN_ENGLISH_US
if( nHeight <= 15 )
{
CFont *pFont = CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT));
return pDC->SelectObject( pFont );
}
else
{
return NULL;
}
#else
font.CreateFont(nHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH,
"楷体" );
return pDC->SelectObject( &font );
#endif
}
示例10: OnPaint
void CAppealDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CDialog::OnPaint()
/*// 2012.12.16 yyf 屏蔽
CGameImageHelper helplt(&m_imgDlgBk);
helplt.BitBlt(dc.GetSafeHdc(),0,0);*/
//绘画框架底图 2012.10.16 yyf
m_configDlg.DrawViewFrame(&dc);
CFont font;
font.CreateFont(-12,0,0,0,400,0,0,0,DEFAULT_CHARSET,3,2,1,2,TEXT("Arial"));
CFont* pOldFont = (CFont*)dc.SelectObject(&font);
dc.SetBkMode(TRANSPARENT);
CBcfFile fMsg(CBcfFile::GetAppPath()+"ClientMessage.bcf");
dc.SetTextColor(RGB(252,255,255));
CString strTitle = fMsg.GetKeyVal("AppealDlg","UserFeedBack","用户反馈");
dc.TextOut(5,5,strTitle);
//dc.TextOut(strTitle,5,5);
dc.SetTextColor(RGB(0,0,0));
strTitle = fMsg.GetKeyVal("AppealDlg","UserName","用户名:");
dc.TextOut(20,50,strTitle);
strTitle = fMsg.GetKeyVal("AppealDlg","Telephone","联系电话:");
dc.TextOut(20,90,strTitle);
strTitle = fMsg.GetKeyVal("AppealDlg","Email","Email:");
dc.TextOut(20,130,strTitle);
/// {{Added by zxd 20100709 释放GDI资源
dc.SelectObject(pOldFont);
font.DeleteObject();
/// Added by zxd 20100709 释放GDI资源}}
}
示例11: OnPaint
//重画函数
void CPrompt::OnPaint()
{
CPaintDC dc(this);
//设置 DC
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(0,0,0));
dc.SelectObject(CSkinResourceManager::GetDefaultFont());
//创建字体
CFont ViewFont;
ViewFont.CreateFont(-12,0,0,0,400,0,0,0,134,3,2,1,1,TEXT("Arial"));
CFont *pOldFont=dc.SelectObject(&ViewFont);
CRect rcScore(0,30,220,30+19);
dc.DrawText(m_tStr,lstrlen(m_tStr),&rcScore,DT_VCENTER|DT_CENTER|DT_END_ELLIPSIS);
//还原字体
dc.SelectObject(pOldFont);
ViewFont.DeleteObject();
return;
}
示例12: Paint
void CMarkComboCtrl::Paint (CDC& dc) {
CSize szShape;
CRect rectCtrl, rectLabel;
CMark mrkStyle;
CFont fntDeflt;
uvar32_64 szKernel;
dc.FillSolidRect (m_rectText, ::GetSysColor (COLOR_WINDOW));
mrkStyle = theApp.MarkStyles[aimActive].GetStyle();
szShape = mrkStyle.GetShapeSize ();
szKernel = mrkStyle.GetKernelSize ();
m_rectText.DeflateRect (4, 4);
rectLabel = m_rectText;
m_rectText.right -= 100;
rectLabel.left = m_rectText.right + 1;
m_rectText.left -= (m_rectText.Height() - m_rectText.Width ()) / 2;
m_rectText.right += (m_rectText.Height() - m_rectText.Width ()) / 2;
if (szShape.cx >= szShape.cy) {
m_rectText.top += (szShape.cx - szShape.cy) / 2;
m_rectText.bottom -= (szShape.cx - szShape.cy) / 2;
} else {
m_rectText.left += (szShape.cy - szShape.cx) / 2;
m_rectText.right -= (szShape.cy - szShape.cx) / 2;
}
GetClientRect (&rectCtrl);
mrkStyle.SetPoint (CPoint ((rectCtrl.Width () - 115 )/ 2, rectCtrl.Height () / 2));
mrkStyle.SetShapeSize (CSize (m_rectText.Width () - 2, m_rectText.Height () - 2));
mrkStyle.SetKernelSize ((szKernel > m_rectText.Height())?m_rectText.Height():szKernel);
mrkStyle.Paint (dc);
fntDeflt.CreatePointFont (80, "Tahoma", &dc);
CFont *pFont = dc.SelectObject (&fntDeflt);
dc.DrawText (theApp.MarkStyles[aimActive].GetName (), rectLabel, DT_END_ELLIPSIS | DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
dc.SelectObject (pFont);
fntDeflt.DeleteObject ();
}
示例13: OnKillFocus
void CSpecEdit::OnKillFocus(CWnd* pNewWnd)
{
CEdit::OnKillFocus(pNewWnd);
// TODO: Add your message handler code here
if (this->m_ComboID==cmb3)
{
CString str;
LOGFONT lf;
CFont* pFont = ((CMyFontDlg*)m_pDlg)->GetSelectedFont();
pFont->GetLogFont(&lf);
pFont->DeleteObject();
GetWindowText(str);
if (str.GetLength()==0)
{
::SendMessage(m_pDlg->GetDlgItem(cmb3)->m_hWnd, CB_SETCURSEL, 0, 0);
GetWindowText(str);
}
int k = _wtoi(str);
lf.lfHeight = -MulDiv(k, GetDeviceCaps(GetParent()->GetDC()->m_hDC, LOGPIXELSY), 72);
pFont->CreateFontIndirectW(&lf);
m_pDlg->InvalidateRect(&((CMyFontDlg*)m_pDlg)->TextRect);
}
if (this->m_ComboID==cmb2)
{
CString str;
GetWindowText(str);
CComboBox* pComboBox = (CComboBox*)(m_pDlg->GetDlgItem(cmb2));
if (str.GetLength()==0 || pComboBox->GetCurSel()==-1)
{
::SendMessageW(m_pDlg->GetDlgItem(cmb2)->m_hWnd, CB_SETCURSEL, 0, 0);
}
}
}
示例14: ReleaseFonts
// *********************************************************************
// ReleaseFonts()
// *********************************************************************
void GdiLabelDrawer::ReleaseFonts(bool useVariableFontSize)
{
if (useVariableFontSize)
{
for (int i = 0; i <= MAX_LABEL_SIZE; i++)
{
if (_fonts[i])
{
CFont * f = _fonts[i];
f->DeleteObject();
delete f;
_fonts[i] = NULL;
}
}
}
else {
if (_font)
{
_font->DeleteObject();
delete _font;
_font = NULL;
}
}
}
示例15: OnPaint
void CDianMu::OnPaint()
{
CPaintDC dc(this);
//SetWindowPos(&wndBottom,0,0,242,137,SWP_NOZORDER);
CGameImageHelper handle(&m_bk);
handle.BitBlt(dc,0,0);
dc.SetBkMode(TRANSPARENT);
CFont font; //JMod-字体格式修改-20090631
font.CreateFont(-12,0,0,0,400,NULL,NULL,NULL,134,3,2,1,2,TEXT("宋体"));
CFont *pOldFont = dc.SelectObject(&font);
dc.TextOut(m_iDestX,m_iDestY,m_strMessage);
dc.SelectObject(pOldFont);
font.DeleteObject();
//jph 100127
HRGN hRgn;
hRgn=AFCBmpToRgn(m_bk,RGB(255,0,255),RGB(1,1,1));
if(hRgn)
{
SetWindowRgn(hRgn,true);
}
}