本文整理汇总了C++中CFont::CreateFont方法的典型用法代码示例。如果您正苦于以下问题:C++ CFont::CreateFont方法的具体用法?C++ CFont::CreateFont怎么用?C++ CFont::CreateFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFont
的用法示例。
在下文中一共展示了CFont::CreateFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
void CMyMainWnd::OnPaint()
{
CPaintDC myDC(this);
CPen myPen;
CRect myRect;
CFont myFont;
CString TypeFace;
switch (r)
{
case 1: myPen.CreatePen(PS_SOLID, 10, RGB(255, 0, 0)); myDC.SelectObject(myPen); myDC.Ellipse(10, 10, 100, 100); break;
case 2: myPen.CreatePen(PS_SOLID, 20, RGB(172, 189, 16)); myDC.SelectObject(myPen); myDC.Ellipse(10, 10, 200, 150); break;
case 3: myPen.CreatePen(PS_SOLID, 30, RGB(122, 124, 221)); myDC.SelectObject(myPen); myDC.Rectangle(10, 10, 300, 100); break;
case 4: myPen.CreatePen(PS_SOLID, 40, RGB(100, 16, 147)); myDC.SelectObject(myPen); myDC.Rectangle(10, 10, 200, 200); break;
case 5: myPen.CreatePen(PS_SOLID, 10, RGB(50, 150, 250)); myDC.SelectObject(myPen); myDC.LineTo(50, 50); myDC.LineTo(75, 0); myDC.LineTo(0,0); break;
case 0: myPen.CreatePen(PS_SOLID, 6, RGB(62, 106, 110)); myDC.SelectObject(myPen); myDC.Rectangle(0,0,0,0); break;
}
switch (i)
{
case 1: myDC.SetTextColor(RGB(255, 0, 0)); TypeFace = "Arial"; myFont.CreateFont(20, 0, 0, 0, FW_BOLD, FALSE, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TypeFace); myDC.SelectObject(myFont); myDC.TextOut(50, 50, L"Text 1"); break;
case 2: myDC.SetTextColor(RGB(172, 189, 16)); TypeFace = "Calibri"; myFont.CreateFont(20, 0, 0, 0, FW_BOLD, FALSE, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TypeFace); myDC.SelectObject(myFont); myDC.TextOut(100, 100, L"Text 2"); break;
case 3: myDC.SetTextColor(RGB(122, 124, 221)); TypeFace = "Courier"; myFont.CreateFont(20, 0, 0, 0, FW_BOLD, FALSE, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TypeFace); myDC.SelectObject(myFont); myDC.TextOut(150, 150, L"Text 3"); break;
case 4: myDC.SetTextColor(RGB(100, 16, 147)); TypeFace = "Cambria"; myFont.CreateFont(20, 0, 0, 0, FW_BOLD, FALSE, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TypeFace); myDC.SelectObject(myFont); myDC.TextOut(200, 200, L"Text 4"); break;
case 5: myDC.SetTextColor(RGB(81, 83, 85)); TypeFace = "Segoe Print"; myFont.CreateFont(20, 0, 0, 0, FW_BOLD, FALSE, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TypeFace); myDC.SelectObject(myFont); myDC.TextOut(250, 250, L"Text 5"); break;
}
}
示例2: DrawText
void CCmgTextArea::DrawText(CDC* pDC,CPoint DrawPoint)
{
CFont aaa;
CFont* OldFont;
BOOL ret;
switch (m_nTextFont)
{
case TEXTFONT_WIN_LOOSE:
ret=aaa.CreateFont(20,10,0,0,FW_BOLD,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Courier New"));
break;
case TEXTFONT_FIELD:
ret=aaa.CreateFont(12,0,0,0,FW_REGULAR,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Verdana"));
break;
case TEXTFONT_FIELD_B:
ret=aaa.CreateFont(12,0,0,0,FW_BOLD,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Verdana"));
break;
case TEXTFONT_SCORE:
ret=aaa.CreateFont(14,0,0,0,FW_REGULAR,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Courier New"));
break;
case TEXTFONT_SCORE_B:
ret=aaa.CreateFont(14,0,0,0,FW_BOLD,0,0,0,ANSI_CHARSET,OUT_CHARACTER_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH,CString("Courier New"));
break;
default:
ASSERT(0);
}
if (ret)
OldFont=pDC->SelectObject(&aaa);
COLORREF OldTextColor=pDC->SetTextColor(m_nTextColor);
COLORREF OldBkColor=pDC->SetBkColor(m_nBkColor);
pDC->SetBkMode(TRANSPARENT);
CPoint p1=m_rArea.TopLeft();
p1.x-=DrawPoint.x;
p1.y-=DrawPoint.y;
#ifdef WIN32
pDC->ExtTextOut(p1.x,p1.y,0,m_rArea,m_sText,NULL);
#else
pDC->ExtTextOut(p1.x,p1.y,0,m_rArea,LPCSTR(m_sText),m_sText.GetLength(),NULL);
#endif
pDC->SetBkColor(OldBkColor);
pDC->SetTextColor(OldTextColor);
if (ret)
pDC->SelectObject(OldFont);
}
示例3: OnPaint
//绘画函数
void CGameParrentView::OnPaint()
{
CPaintDC dc(this);
//判断模式
if (m_pThreadDraw!=NULL) return;
//获取位置
CRect ClientRect;
GetClientRect(&ClientRect);
//重画缓冲区
if ((m_bDoubleBuf==true)&&(m_ImageBuffer.IsNull()==false))
{
if (m_bReDraw==true)
{
//创建字体
CFont DrawFont;
DrawFont.CreateFont(-12,0,0,0,400,0,0,0,134,3,2,1,2,TEXT("宋体"));
CDC * pDC=CDC::FromHandle(m_ImageBuffer.GetDC());
CFont * pOldFont=pDC->SelectObject(&DrawFont);
//更新缓冲
m_bReDraw=false;
pDC->SetBkMode(TRANSPARENT);
pDC->FillSolidRect(0,0,ClientRect.Width(),ClientRect.Height(),RGB(0,0,150));
DrawGameView(pDC,ClientRect.Width(),ClientRect.Height());
// DrawGameViewFrame(pDC,ClientRect.Width(),ClientRect.Height());
//清理资源
pDC->SelectObject(pOldFont);
m_ImageBuffer.ReleaseDC();
DrawFont.DeleteObject();
}
//绘画界面
CRect rcClip;
dc.GetClipBox(&rcClip);
m_ImageBuffer.BitBlt(dc,rcClip.left,rcClip.top,rcClip.Width(),rcClip.Height(),rcClip.left,rcClip.top);
}
else
{
//创建字体
CFont DrawFont;
DrawFont.CreateFont(-12,0,0,0,400,0,0,0,134,3,2,1,2,TEXT("宋体"));
CFont * pOldFont=dc.SelectObject(&DrawFont);
//绘画界面
dc.SetBkMode(TRANSPARENT);
DrawGameView(&dc,ClientRect.Width(),ClientRect.Height());
// DrawGameViewFrame(&dc,ClientRect.Width(),ClientRect.Height());
//清理资源
dc.SelectObject(pOldFont);
DrawFont.DeleteObject();
}
return;
}
示例4: OnPaint
void CVideoPane::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
// 绘制标题栏
if (NULL != m_pImgCaption)
{
// 设置坐标
CRect rect;
GetClientRect(rect);
Gdiplus::Rect gRect(rect.left, rect.top, rect.right, CAPTION_HEIGHT);
Gdiplus::ImageAttributes ImgAtt;
ImgAtt.SetWrapMode(Gdiplus::WrapModeTileFlipXY);
Gdiplus::Graphics graphics(dc);
graphics.DrawImage(m_pImgCaption, gRect, 0, 0, (INT)m_pImgCaption->GetWidth(), (INT)m_pImgCaption->GetHeight(), Gdiplus::UnitPixel, &ImgAtt);
}
// 标题栏文本
CRect rect;
GetClientRect(rect);
rect.left += BTN_CLOSE_SPACE;
rect.bottom = CAPTION_HEIGHT;
dc.SetBkMode(CAPTION_FONT_BKCLR);
dc.SetTextColor(CAPTION_FONT_COLOR);
CFont font;
font.CreateFont(CAPTION_FONT_SIZE, 0, 0, 0, FW_NORMAL, FALSE,FALSE,FALSE,0,0,0,0,0,CAPTION_FONT_NAME);
dc.SelectObject(font);
dc.DrawText(m_strCaptionText, -1, &rect, DT_SINGLELINE | DT_VCENTER);
}
示例5: OnPaint
void CDlgLeftShow::OnPaint()
{
CPaintDC dc(this);
CGameImageHelper handle(&m_bkimage);
handle.BitBlt(dc.GetSafeHdc(),0,0);
int y=25;
TCHAR szBuffer[200];
memset(szBuffer,0,sizeof(szBuffer));
// WCHAR wszBuffer[200];
dc.SetTextColor(RGB(146,220,255));
dc.SetBkMode(TRANSPARENT);
//图片
/*::lstrcpy(szBuffer,TEXT("image\\log\\gamelog%ld.png"));
MultiByteToWideChar(CP_ACP,MB_COMPOSITE,szBuffer,-1,wszBuffer,sizeof(wszBuffer));
Graphics graphics(dc.GetSafeHdc()); // Create a GDI+ graphics object
Image image(wszBuffer); // Construct an image
graphics.DrawImage(&image, 125, 4, image.GetWidth(), image.GetHeight());*/
CFont font;
font.CreateFont(15,0,0,0,400,NULL,NULL,NULL,134,3,2,1,2,TEXT("宋体"));
dc.SelectObject(font);
//妮称
wsprintf(szBuffer,TEXT("%s"),m_nickName);
CRect rect(115,45,230,60);
dc.DrawText(szBuffer,lstrlen(szBuffer),&rect,DT_CENTER|DT_TOP|DT_END_ELLIPSIS);
font.DeleteObject();
}
示例6: OnPaint
void CShowScore::OnPaint()
{
CPaintDC dc(this);
dc.SetBkMode(TRANSPARENT);
CFont font;
font.CreateFont(-12,0,0,0,400,NULL,NULL,NULL,134,3,2,1,2,TEXT("宋体"));
dc.SelectObject(&font);
dc.SetTextColor(m_textcr);
CGameImageHelper handle(&m_bk);
handle.BitBlt(dc.GetSafeHdc(),0,0);
TCHAR sz[100];
CRect rect;
for(int i = 0; i < MAX_PEOPLE; i ++)
{
if(m_pUserItem[i] == NULL)
continue;
wsprintf(sz,"%s",m_pUserItem[i]->GameUserInfo.nickName);
rect.left=m_listx;
rect.right=rect.left+m_w1;
rect.top=m_listy+i*(m_itemh+w);
rect.bottom=rect.top+m_itemh;
dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
wsprintf(sz,"%d",m_lastscore[i]);
rect.left=m_listx+m_w1+w;
rect.right=rect.left+m_w2;
rect.top=m_listy+i*(m_itemh+w);
rect.bottom=rect.top+m_itemh;
dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
wsprintf(sz,"%d",m_allscore[i]);
rect.left=m_listx+m_w1+w*2+m_w3-5;
rect.right=rect.left+m_w3;
rect.top=m_listy+i*(m_itemh+w);
rect.bottom=rect.top+m_itemh;
dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
//if(m_ucomtype==TY_MONEY_GAME)
{
TCHAR szNum[128];
GetNumString(szNum, m_lastmoney[i], Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar);
wsprintf(sz,"%s",szNum);
rect.left=m_listx+m_w1+m_w2+m_w3+w*3-2;
rect.right=rect.left+m_w4;
rect.top=m_listy+i*(m_itemh+w);
rect.bottom=rect.top+m_itemh;
dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
//wsprintf(sz,"%d",m_allmoney[i]);
GetNumString(szNum, m_allmoney[i], Glb().m_nPowerOfGold,Glb().m_bUseSpace, Glb().m_strSpaceChar);
wsprintf(sz,"%s",szNum);
rect.left=m_listx+m_w1+m_w2+m_w3+w+m_w4;
rect.right=rect.left+m_w5;
rect.top=m_listy+i*(m_itemh+w);
rect.bottom=rect.top+m_itemh;
dc.DrawText(sz,lstrlen(sz),&rect,DT_CENTER|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
}
}
}
示例7: OnDraw
void QuoteTableCtrlGeneralSort::OnDraw(CDC* pDC)
{
CHSGridCtrl::OnDraw(pDC);
CRect rect, itemrect, rccvlient;
GetClientRect(rccvlient);
ClientToScreen(rccvlient);
GetClientRect(rect);
itemrect = rect;
if (GetRowCount() <=0)
return;
int rowheight = GetRowHeight(0);
itemrect.bottom = rowheight-1;
COLORREF bkcolor = GetBkColor();
COLORREF textcolor = RGB(155,155,155);
if (m_iColorFontProt)
textcolor = m_iColorFontProt->GetQuoteTabTextColor();
CFont* pFont;
CFont* pOldFont;
BOOL bCreat = FALSE;
if (m_iFont)
pFont = (CFont*)m_iFont->GetQuoteColHeadFont();
else
{
pFont = new CFont();
VERIFY(pFont->CreateFont(16,0, 0,0,FW_NORMAL,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,
DEFAULT_PITCH | FF_SWISS, _T("宋体")));
bCreat = TRUE;
}
pOldFont = pDC->SelectObject(pFont);
pDC->SetBkColor( GetSysColor(COLOR_HIGHLIGHT) );
pDC->SetBkColor(bkcolor);
pDC->SetTextColor(textcolor);
pDC->SetBkColor(bkcolor);
pDC->DrawText(m_pTableFlag->strTitle, &itemrect, DT_CENTER | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
pDC->SelectObject(pOldFont);
if (bCreat)
pFont->DeleteObject();
CPen hPen;
hPen.CreatePen(PS_SOLID ,1,RGB(200,0,0));
CPen* hOldPen = pDC->SelectObject(&hPen);
pDC->MoveTo(CPoint(itemrect.left,itemrect.bottom));
pDC->LineTo(CPoint(itemrect.right, itemrect.bottom));
pDC->SelectObject(hOldPen);
hPen.DeleteObject();
}
示例8: Draw
void CDiagramCombobox::Draw( CDC* dc, CRect rect )
/* ============================================================
Function : CDiagramCombobox::Draw
Description : Draws the "control"
Return : void
Parameters : CDC* dc - CDC to draw to
CRect rect - Total object rect (zoomed)
Usage :
============================================================*/
{
CStdGrfx::drawsunkenframed3dWindow( dc, rect );
LOGFONT lf;
GetFont( lf );
dc->SetBkMode( TRANSPARENT );
dc->SetTextColor( ::GetSysColor( COLOR_BTNTEXT ) );
CRect rectArrow( rect );
rectArrow.left = rectArrow.right - ( int ) ( ( double ) GetMinimumSize().cy * GetZoom() );
rectArrow.InflateRect( -2, -2 );
CStdGrfx::drawframed3dBox( dc, rectArrow );
CFont chk;
chk.CreateFont( lf.lfHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DECORATIVE, "Marlett" );
dc->SelectObject( &chk );
dc->DrawText( "u", rectArrow, DT_VCENTER | DT_SINGLELINE | DT_CENTER );
dc->SelectStockObject( DEFAULT_GUI_FONT );
}
示例9: Initialize
void CResultDialog::Initialize()
{
// Set Fixed Width Font for rich edit control
CRichEditCtrl *pEd = (CRichEditCtrl *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
CFont aFixedWidthFont;
VERIFY(aFixedWidthFont.CreateFont(
15, // nHeight
5, // 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
FF_MODERN, // Fix width fonts are FF_MODERN
L"Courier New")); // lpszFacename
pEd->SetFont(&aFixedWidthFont, false);
// save button's width and height, so they are calculated only once
RECT rect;
CWnd *pBCopy = (CWnd *) GetDlgItem (IDC_CopySelectionToClipboard);
pBCopy->GetWindowRect(&rect);
bw = rect.right - rect.left; // a button's width (they are all equal)
bh = rect.bottom - rect.top; // a button's height
}
示例10: Draw
void CDiagramRadiobutton::Draw( CDC* dc, CRect rect )
/* ============================================================
Function : CDiagramRadiobutton::Draw
Description : Draws the "control"
Return : void
Parameters : CDC* dc - CDC to draw to
CRect rect - Total object rect (zoomed)
Usage :
============================================================*/
{
dc->SelectObject( CStdGrfx::dialogBrush() );
dc->SelectObject( CStdGrfx::dialogPen() );
dc->Rectangle( rect );
LOGFONT lf;
CFont chk;
CFont font;
GetFont( lf );
// MS Sans Serif will not scale below 8 pts
if( GetZoom() < 1 )
lstrcpy( lf.lfFaceName, _T( "Arial" ) );
font.CreateFontIndirect( &lf );
// Marlett is used for the circle
chk.CreateFont( ( int ) ( ( double ) lf.lfHeight * 1.25 ), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DECORATIVE, "Marlett" );
dc->SetBkMode( TRANSPARENT );
dc->SelectObject( &chk );
dc->SetTextColor( ::GetSysColor( COLOR_WINDOW ) );
dc->TextOut( rect.left, rect.top, "n" );
dc->SetTextColor( ::GetSysColor( COLOR_3DSHADOW ) );
dc->TextOut( rect.left, rect.top, "j" );
dc->SetTextColor( ::GetSysColor( COLOR_3DHIGHLIGHT ) );
dc->TextOut( rect.left, rect.top, "k" );
dc->SetTextColor( ::GetSysColor( COLOR_3DDKSHADOW ) );
dc->TextOut( rect.left, rect.top, "l" );
dc->SetTextColor( ::GetSysColor( COLOR_3DLIGHT ) );
dc->TextOut( rect.left, rect.top, "m" );
dc->SelectObject( &font );
dc->SetTextColor( ::GetSysColor( COLOR_BTNTEXT ) );
rect.left += ( int ) ( ( double ) abs( lf.lfHeight ) * 1.5 );
dc->DrawText( GetTitle(), rect, DT_SINGLELINE );
dc->SelectStockObject( DEFAULT_GUI_FONT );
dc->SelectStockObject( BLACK_PEN );
dc->SelectStockObject( WHITE_BRUSH );
}
示例11: OnInitialUpdate
void InfoFrom::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
CRect m_wndRect;
GetClientRect(&m_wndRect);
CRect m_headerRect;
// create the header
{
m_headerRect.left = m_headerRect.top = -1;
m_headerRect.right = m_wndRect.Width();
m_treeList.m_wndHeader.Create(WS_CHILD | WS_VISIBLE | HDS_BUTTONS | HDS_HORZ, m_headerRect, this, ID_TREE_LIST_HEADER);
}
static CFont font;
font.CreateFont(100, 0, 0, 0, FW_NORMAL, FALSE,FALSE,FALSE,GB2312_CHARSET,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_MODERN,"宋体");
//m_treeList.m_wndHeader.SetFont(&font);
m_treeList.SetFont(&font);
CSize textSize;
// set header's pos, dimensions and image list
{
CDC *pDC = m_treeList.m_wndHeader.GetDC();
pDC->SelectObject(&m_treeList.m_headerFont);
textSize = pDC->GetTextExtent("A");
m_treeList.m_wndHeader.SetWindowPos(&wndTop, 0, 0, m_headerRect.Width(), textSize.cy+4, SWP_SHOWWINDOW);
//m_treeList.m_cImageList.Create(IDB_HEADER, 16, 10, 0);
//m_treeList.m_wndHeader.SetImageList(&m_treeList.m_cImageList);
m_treeList.m_wndHeader.UpdateWindow();
}
CRect m_treeListRect;
// create the tree itself
{
GetClientRect(&m_wndRect);
m_treeListRect.left=0;
m_treeListRect.top = textSize.cy+4;
m_treeListRect.right = m_headerRect.Width()-5;
m_treeListRect.bottom = m_wndRect.Height()-GetSystemMetrics(SM_CYHSCROLL)-4;
m_treeList.Create(WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS, m_treeListRect, this, ID_TREE_LIST_CTRL);
}
m_treeList.InsertColumn(0, "名称", LVCFMT_LEFT, 360);
m_treeList.InsertColumn(1, "详细内容", LVCFMT_LEFT, 360);
m_init = TRUE;
SortTree(0, TRUE, m_treeList.GetRootItem());
}
示例12: drawGameOver
void CGreedySnakeView::drawGameOver()
{
CClientDC dc(this);
CDC memDC;
CRect rectClient;
GetClientRect(rectClient);
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(&m_bmpGameOver);
dc.BitBlt(0, 0, rectClient.right, rectClient.bottom, &memDC, 400, 400, SRCCOPY);
CFont font;
font.CreateFont(120, 0, 0, 0, FW_NORMAL,
FALSE, FALSE, 0,
ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS, _T("Arial"));
dc.SelectObject(&font);
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(::GetSysColor( COLOR_3DHILIGHT));
dc.DrawText( _T(" Game Over! "), CRect(12, 230, 800, 330),
DT_SINGLELINE | DT_LEFT |DT_VCENTER|DT_CENTER);
dc.SelectStockObject(BLACK_BRUSH);
font.DeleteObject();
memDC.DeleteDC();
}
示例13: OnPaint
void CDlgDIYChat::OnPaint()
{
CPaintDC dc(this);
/*// 2012.12.17 yyf 屏蔽
CGameImageHelper handle(&m_bkimage);
handle.BitBlt(dc.GetSafeHdc(),0,0);*/
//绘画框架底图 2012.10.17 yyf
m_configDlg.DrawViewFrame(&dc);
CFont Font;//,*OldFont;
Font.CreateFont(15,10,0,0,0,0,0,0,GB2312_CHARSET
,3,2,1,2,TEXT("宋体"));
CWnd *pWnd=GetDlgItem(IDC_LIST_CHAT);
CDC *pDC=pWnd->GetDC();
pDC->SelectObject(&Font);
pWnd->SetFont(&Font,true);
// DeleteObject(pDC->SelectObject(OldFont));
ReleaseDC(pDC);
pWnd=GetDlgItem(IDC_EDIT1);
pDC=pWnd->GetDC();
pDC->SelectObject(&Font);
pWnd->SetFont(&Font,true);
// DeleteObject(pDC->SelectObject(OldFont));
ReleaseDC(pDC);
}
示例14: ReadCfg
void CConfigDlg::ReadCfg()
{
SDComCfg *pDComCfg;
UINT nBytes;
CFont font;
if (m_bDComCfgValid == false)
{
memset(&m_sDComCfgReal, 0, sizeof(m_sDComCfgReal));
m_bDComCfgValid = true;
m_sDComCfgReal.m_crFore = RGB(0xcc, 0xcc, 0xcc);
m_sDComCfgReal.m_crBack = RGB(0x00, 0x00, 0x00);
font.CreateFont(12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _T("Courier"));
font.GetLogFont(&m_sDComCfgReal.m_logfont);
m_sDComCfgReal.m_nNumLines = 20000;
m_sDComCfgReal.m_nWinWidth = 0;
if (AfxGetApp()->GetProfileBinary(DCOM_SETTINGS_SECTION,
DCOM_SETTINGS_CONFIG, (LPBYTE*)&pDComCfg, &nBytes) == TRUE)
{
if (nBytes <= sizeof(SDComCfg))
{
memcpy(&m_sDComCfgReal, pDComCfg, nBytes);
if (nBytes < sizeof(SDComCfg))
{
memset(((char*)(&m_sDComCfgReal)) + nBytes, 0, sizeof(SDComCfg) - nBytes);
}
}
delete pDComCfg;
}
memcpy(&m_sDComCfgTmp, &m_sDComCfgReal, sizeof(SDComCfg));
}
}
示例15: SetCtrlFont
VOID CAboutDlg::SetCtrlFont(INT IDC_STATIC_CTRL,UINT nFontSize)
{
CStatic *pStatic = reinterpret_cast<CStatic *>(GetDlgItem(IDC_STATIC_CTRL));
ASSERT(pStatic);
CFont pFont;
VERIFY(pFont.CreateFont(
nFontSize, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_BLACK, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
FALSE, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
_T("Microsoft Sans Serif"))); // lpszFacename
pStatic->SetFont(&pFont, TRUE);
}