本文整理汇总了C++中CFont类的典型用法代码示例。如果您正苦于以下问题:C++ CFont类的具体用法?C++ CFont怎么用?C++ CFont使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dc
void ecMemoryLayoutWindow::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this);
PrepareDC(dc);
ecConfigToolDoc* pDoc = wxGetApp().GetConfigToolDoc();
if (pDoc == NULL) // no document so nothing to draw
return;
#if 0
// clear the lists of region and section rectangles used for hit testing
listRegionRect.RemoveAll ();
listSectionRect.RemoveAll ();
// setup background mode
int nOldBkMode = pDC->SetBkMode (TRANSPARENT);
// setup font
CFont fntName;
if (!fntName.CreatePointFont (80, _T("MS Sans Serif"), pDC))
return;
CFont * pOldFont = pDC->SelectObject (&fntName);
// determine max unit count for any region
mem_map * pMemoryMap = &CConfigTool::GetConfigToolDoc()->MemoryMap;
// calculate the unit scaling for DISPLAY_MODE 1
UINT uPixelsPerUnit = UNIT_WIDTH_MIN;
RECT rectClientRect;
if (m_uUnitCountMax != 0) // if there is something to draw
{
GetClientRect (&rectClientRect);
uPixelsPerUnit = __max ((m_uClientWidth - HORIZ_BORDER * 2) / m_uUnitCountMax, UNIT_WIDTH_MIN);
m_uViewWidth = uPixelsPerUnit * m_uUnitCountMax + HORIZ_BORDER * 2;
}
// draw the regions
UINT uRegion = 0;
UINT uUnitCount;
list <mem_region>::iterator region;
for (region = pMemoryMap->region_list.begin (); region != pMemoryMap->region_list.end (); ++region)
{
uUnitCount = 0;
for (list <mem_section_view>::iterator section_view = region->section_view_list.begin (); section_view != region->section_view_list.end (); ++section_view)
uUnitCount += (section_view->section == NULL ? 1 : UNITS_PER_SECTION);
if (DISPLAY_MODE == 1)
DrawRegion (pDC, uRegion++, uUnitCount, uPixelsPerUnit, region);
else // DISPLAY_MODE == 2
DrawRegion (pDC, uRegion++, uUnitCount, (rectClientRect.right - HORIZ_BORDER * 2) / uUnitCount, region);
}
pDC->SelectObject (pOldFont);
pDC->SetBkMode (nOldBkMode);
#endif
}
示例2: GetPrinterFont
void CPadView::OnChoosePrintFont()
{
CWaitCursor wait;
CFont* pFont = GetPrinterFont();
LOGFONT lf;
LPLOGFONT plf = NULL;
if (pFont != NULL)
{
pFont->GetObject(sizeof(LOGFONT), &lf);
plf = &lf;
}
// magic to get printer dialog that would be used if we were printing!
CPrintDialog dlgPrint(FALSE);
if (!AfxGetApp()->GetPrinterDeviceDefaults(&dlgPrint.m_pd))
{
AfxMessageBox(IDP_ERR_GET_DEVICE_DEFAULTS);
return;
}
wait.Restore();
HDC hdcPrint = dlgPrint.CreatePrinterDC();
if (hdcPrint == NULL)
{
AfxMessageBox(IDP_ERR_GET_PRINTER_DC);
return;
}
CDC dcScreen;
dcScreen.Attach(::GetDC(NULL));
CDC dcPrint;
dcPrint.Attach(hdcPrint);
if (plf != NULL)
{
// need to map initial logfont to screen metrics.
::ScaleLogFont(plf, dcPrint, dcScreen);
}
// now bring up the dialog since we know the printer DC
CFontDialog dlg(plf, CF_PRINTERFONTS, &dcPrint);
if (dlg.DoModal() == IDOK)
{
// map the resulting logfont back to printer metrics.
lf = dlg.m_lf;
::ScaleLogFont(&lf, dcScreen, dcPrint);
SetPrinterFont(NULL);
m_fontPrint.DeleteObject();
if (m_fontPrint.CreateFontIndirect(&lf))
{
SetPrinterFont(&m_fontPrint);
m_lfDefPrintFont = lf;
// notify container that content has changed
GetDocument()->UpdateAllItems(NULL);
}
}
//NOTE: destructor will call dcPrint.DeleteDC
::ReleaseDC(NULL, dcScreen.Detach());
}
示例3: GetSystemMetrics
void CTreeListFrame::Initialize()
{
// creates all the objects in frame -
// header, tree, horizontal scroll bar
int scrollBarWidth = GetSystemMetrics(SM_CXHSCROLL);
int scrollBarHeight = GetSystemMetrics(SM_CYHSCROLL);
CRect m_wndRect;
GetWindowRect(&m_wndRect);
CRect m_headerRect;
// create the header
{
//m_headerRect.left = m_headerRect.top = -1;
m_headerRect.left = m_headerRect.top = 0;
m_headerRect.right = m_wndRect.Width();
getTree().m_wndHeader.Create(WS_CHILD | WS_VISIBLE | HDS_BUTTONS | HDS_HORZ, m_headerRect, this, ID_TREE_LIST_HEADER);
}
CSize textSize;
// set header's pos, dimensions and image list
{
LOGFONT logfont;
CFont *pFont = GetParent()->GetFont();
pFont->GetLogFont( &logfont );
getTree().m_headerFont.CreateFontIndirect( &logfont );
getTree().m_wndHeader.SetFont(&getTree().m_headerFont);
CDC *pDC = getTree().m_wndHeader.GetDC();
pDC->SelectObject(&getTree().m_headerFont);
textSize = pDC->GetTextExtent("A");
//getTree().m_wndHeader.SetWindowPos(&wndTop, -1, -1, m_headerRect.Width(), textSize.cy+4, SWP_SHOWWINDOW);
getTree().m_wndHeader.SetWindowPos(&wndTop, 0, 0, m_headerRect.Width(), textSize.cy+4, SWP_SHOWWINDOW);
getTree().m_cImageList.Create(IDB_HEADERSORTARROWS, 16, 10, RGB(192,192,192));
getTree().m_wndHeader.SetImageList(&getTree().m_cImageList);
}
CRect m_treeRect;
// create the tree itself
{
GetWindowRect(&m_wndRect);
m_treeRect.left = 0;
m_treeRect.top = textSize.cy + 4;
m_treeRect.right = m_headerRect.Width() - 5;
//m_treeRect.bottom = m_wndRect.Height() - GetSystemMetrics(SM_CYHSCROLL) - 4;
m_treeRect.bottom = m_wndRect.Height() - GetSystemMetrics(SM_CYHSCROLL);
getTree().Create(WS_BORDER | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS, m_treeRect, this, ID_TREE_LIST_CTRL);
}
// finally, create the horizontal scroll bar
{
CRect m_scrollRect;
m_scrollRect.left = 0;
m_scrollRect.top = m_treeRect.bottom;
int scrollRectTop = m_wndRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
m_scrollRect.right = m_treeRect.Width() - GetSystemMetrics(SM_CXVSCROLL);
m_scrollRect.bottom = m_wndRect.bottom;
m_horScrollBar.Create(WS_CHILD | WS_VISIBLE | WS_DISABLED | SBS_HORZ | SBS_TOPALIGN, m_scrollRect, this, ID_TREE_LIST_SCROLLBAR);
}
SortTree(0, TRUE, getTree().GetRootItem());
}
示例4: XTPMarkupSetDefaultFont
void CXTPPopupItem::CalculateWidth()
{
if (m_pRichRender)
{
return;
}
if (m_pUIElement)
{
XTPMarkupSetDefaultFont(m_pControl->GetMarkupContext(), (HFONT)GetTextFont()->GetSafeHandle(), COLORREF_NULL);
CSize sz = XTPMarkupMeasureElement(m_pUIElement, m_rcItem.Width());
m_rcItem.right = m_rcItem.left + sz.cx;
m_rcItem.bottom = m_rcItem.top + sz.cy;
return;
}
CXTPImageManagerIcon* pIcon = GetImage();
if (pIcon)
{
m_rcItem.right = m_rcItem.left + pIcon->GetWidth();
return;
}
if (m_nAlign & DT_WORDBREAK) return;
CWindowDC dc(NULL);
CRect rcText(0, 0, 0, m_rcItem.Height());
CFont fntUnderline;
CFont* pFont = GetTextFont();
if (IsHyperLink() && IsUnderline() || IsBold())
{
LOGFONT lpLogFont;
pFont->GetLogFont(&lpLogFont);
lpLogFont.lfUnderline = (IsHyperLink() && IsUnderline());
lpLogFont.lfWeight = IsBold() ? FW_BOLD : FW_NORMAL;
VERIFY(fntUnderline.CreateFontIndirect(&lpLogFont));
pFont = &fntUnderline;
}
CXTPFontDC font(&dc, pFont);
dc.DrawText(m_strCaption, rcText, m_nAlign | DT_CALCRECT);
if (m_nAlign & DT_RIGHT)
{
m_rcItem.left = m_rcItem.right - rcText.Width();
}
else if (m_nAlign & DT_CENTER)
{
LONG lCentrl = m_rcItem.left + m_rcItem.Width()/2;
m_rcItem.left = lCentrl - rcText.Width()/2;
m_rcItem.right = m_rcItem.left + rcText.Width();
}
else
{
m_rcItem.right = m_rcItem.left + rcText.Width();
}
}
示例5: DrawViewImage
//绘画界面
void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight)
{
//绘画背景
DrawViewImage(pDC,m_ImageBack,enMode_Spread);
DrawViewImage(pDC,m_ImageCenter,enMode_Centent);
CImageHandle HandleHeadBg(&m_ImageHeadBg);
//放弃标志
CImageHandle HnadleUserPass(&m_ImageUserPass);
for (WORD i=0;i<GAME_PLAYER;i++)
{
if (m_bPass[i])
{
m_ImageUserPass.AlphaDrawImage(pDC,m_pPass[i].x,m_pPass[i].y,RGB(255,0,255));
}
}
//绘画用户
TCHAR szBuffer[32];
for (WORD i=0;i<GAME_PLAYER;i++)
{
//变量定义
WORD wUserTimer=GetUserTimer(i);
const tagUserData * pUserData=GetUserInfo(i);
pDC->SetTextColor(RGB(0,255,255));
//绘画用户
if (pUserData!=NULL)
{
//m_ImageHeadBg.BitBlt(pDC->m_hDC,m_ptFace[i].x-2,m_ptFace[i].y-2);
//用户名字
//pDC->SetTextColor((wUserTimer>0)?RGB(250,250,250):RGB(220,220,220));
//pDC->SetTextAlign(i==0||i==2?TA_RIGHT:TA_LEFT);
pDC->TextOut(m_ptName[i].x,m_ptName[i].y,pUserData->szName,lstrlen(pUserData->szName));
pDC->TextOut(m_pZhanPaiName[i].x,m_pZhanPaiName[i].y-30,pUserData->szName,lstrlen(pUserData->szName));
pDC->TextOut(nWidth/2-2*m_nXFace-2*m_nXBorder,2*m_nYFace+m_nYBorder-2*16+i*16+26,pUserData->szName,lstrlen(pUserData->szName));
//设置上一局成绩
_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_lForeScore[i]);
pDC->TextOut(nWidth/2+7,2*m_nYFace+m_nYBorder-2*16+i*16+26,szBuffer,lstrlen(szBuffer));
//设置总成绩
_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_lAllScore[i]);
pDC->TextOut(nWidth/2+2*m_nXFace+2*m_nXBorder,2*m_nYFace+m_nYBorder-2*16+i*16+26,szBuffer,lstrlen(szBuffer));
//剩余扑克
if (pUserData->cbUserStatus>=US_PLAY)
{
_snprintf(szBuffer,sizeof(szBuffer),TEXT("(%ld 张)"),m_bCardCount[i]);
pDC->TextOut(m_pZhanPaiName[i].x+17*m_nXFace+6*m_nXBorder,m_pZhanPaiName[i].y-30,szBuffer,lstrlen(szBuffer));
//设置掀人次数
_snprintf(szBuffer,sizeof(szBuffer),TEXT("掀牌:%d次"),m_bXianCount[i]);
pDC->TextOut(m_pZhanPaiName[i].x+12*m_nXFace+2*m_nXBorder,m_pZhanPaiName[i].y-30,szBuffer,lstrlen(szBuffer));
//设置被掀次数
_snprintf(szBuffer,sizeof(szBuffer),TEXT("被掀:%d次"),m_bBeiXianCount[i]);
pDC->TextOut(m_pZhanPaiName[i].x+12*m_nXFace+2*m_nXBorder,m_pZhanPaiName[i].y-43,szBuffer,lstrlen(szBuffer));
//设置占牌数目
_snprintf(szBuffer,sizeof(szBuffer),TEXT("%d"),m_bZhanPaiCount[i]);
pDC->TextOut(m_pZhanPaiName[i].x+500+4*m_nXBorder,m_pZhanPaiName[i].y-25,szBuffer);
//绘画时间标志
DrawTime(pDC,nWidth,nHeight);
}
//其他信息
if (wUserTimer!=0) DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer);
if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y);
DrawUserFace(pDC,pUserData->wFaceID,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE);
}
}
//描述信息
for(BYTE i=0;i<GAME_PLAYER;i++)
if (m_bCouPaiTitle[i]==true)
{
//创建资源
CFont InfoFont;
InfoFont.CreateFont(-36,0,0,0,400,0,0,0,134,3,2,1,2,TEXT("黑体"));
//设置 DC
pDC->SetTextColor(RGB(201,229,133));
pDC->SetTextAlign(TA_CENTER|TA_TOP);
CFont * pOldFont=pDC->SelectObject(&InfoFont);
//绘画信息
if(i%2)
pDC->TextOut(nWidth/2,m_ptFace[i].y-6*m_nYFace-8,"扣牌");
else if(m_ptFace[i].x<nWidth/2)
pDC->TextOut(m_ptFace[i].x+5*m_nXFace,m_ptFace[i].y-8,"扣牌");
else
pDC->TextOut(m_ptFace[i].x-4*m_nXFace,m_ptFace[i].y-8,"扣牌");
//.........这里部分代码省略.........
示例6: DrawKeysText
// Keys Text
//------------------------------------------------------------------------------------------------------------
void cAmp::DrawKeysText()
{
CFont* cf = cfont[view.cfP]; //~
#define clr(r,g,b) cf->Fclr = D3DXCOLOR(r,g,b,1)
//if (shift) { cf->StrWr("shift", xSize/2,Fy); }
//if (ctrl) { cf->StrWr("ctrl", xSize/2+40,Fy); }
//if (alt) { cf->StrWr("alt", xSize/2+70,Fy); }
/* Edit name */
if (ed==ED_nTab)
{
clr(0.5,0.9,1); int y = yB_pli;
cf->StrWr("Tab name: ", 1,y);
cf->StrWr(sed, cf->xwr+10,y);
int x = cf->xwr+1; // cursor |
fTi+=dt; if (fTi > 0.7f) fTi=0.f; //blink
D3DRECT r= {x, y, x+2, y+cf->Fy}; pDev->Clear(1, &r, clFl, RGB(fTi*200+50,fTi*200,0), 1.f, 0);
}
/* Edit search */
if (ed==ED_nFind)
{
clr(0.3,1,0); int y = yB_pli;
cf->StrWr("Search: ", 1,y);
cf->StrWr(sed, cf->xwr+10,y); //x2
int x = cf->xwr+1; // cursor |
fTi+=dt; if (fTi > 0.7f) fTi=0.f; //blink
D3DRECT r= {x, y, x+2, y+cf->Fy}; pDev->Clear(1, &r, clFl, RGB(0,fTi*200+50,0), 1.f, 0);
}
/// Keys list
if (ed!=ED_Keys) return;
cf = cfont[view.cfG]; //~
int y = yB_gc, x=5;
clr(1,1,1);
cf->StrWr("Global HotKeys", 15, yB_gc-90+15);
cf->StrWr("OK", 150+18, yB_gc-80+2);
clr(0.5,0.8,1.0);
cf->StrWr("Function Shift Ctrl Alt Key", 15, yB_gc-25);
clr(0.6,0.7,0.7);
cf->StrWr("LMB- choose RMB- on/off", x+120, yB_gc-90+40);
for (int i=0; i<FU_ALL; i++)
{
if (vKeys[i].on)
clr(1,1,1); else clr(0.5,0.6,0.7);
cf->StrWr(cswFuns[i], 5+x, y);
if (i == yPickKey && bPickingKey)
{ clr(1,1,1);
cf->StrCopy(" Press new key..."); }
else
strKeyName(vKeys[i].vk, vKeys[i].sc, cf->str);
cf->Write(xB_gck+5+x, y);
y += yH_gc + 16*cyFadd[i]/2;
}
}
示例7: dc
void CKSInputDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC memDC;
CBitmap bkBit,*oldBkBit;
CRect client;
RECT clientRect,edtRect;
dc.GetClipBox(client);
if(memDC.CreateCompatibleDC(&dc))
{
memDC.SetBkMode(TRANSPARENT);
if(bkBit.CreateCompatibleBitmap(&dc,client.Width(),client.Height()))
{
oldBkBit = memDC.SelectObject(&bkBit);
/*
CBrush brh;
brh.CreateSolidBrush( RGB(0,0,255) );
brh.UnrealizeObject();
memDC.FillRect( client , &brh );
*/
if(m_config)
{
CRect parentRect;
CWnd * parentWnd = GetParent();
ASSERT(parentWnd != NULL);
parentWnd->GetWindowRect(parentRect);
GetWindowRect(&clientRect);
m_config->m_bkImg.m_Dest.x = -(clientRect.left);
m_config->m_bkImg.m_Dest.y = -(clientRect.top);
m_config->m_bkImg.m_DestSize.cx = parentRect.Width();
m_config->m_bkImg.m_DestSize.cy = parentRect.Height();
m_config->m_bkImg.m_Src.x = 0;
m_config->m_bkImg.m_Src.y = 0;
m_config->m_bkImg.m_SrcSize.cx = m_config->m_bkImg.GetWidth();
m_config->m_bkImg.m_SrcSize.cy = m_config->m_bkImg.GetHeight();
m_config->m_bkImg.Display(&memDC);
/*
dc.StretchBlt(0,0,client.Width(),client.Height(),&memDC
,0,0,m_config->m_bkImg.GetWidth(),m_config->m_bkImg.GetHeight(),SRCCOPY);
*/
}
//////////////////////////////////////////////////////////////////////////
// 设置字体
LOGFONT lf;
memset(&lf,0,sizeof lf);
lf.lfCharSet = GB2312_CHARSET;
strcpy(lf.lfFaceName,m_fontName.GetBuffer(1));
lf.lfHeight = m_fontSize;
lf.lfWeight = FW_BOLD;
CFont font;
CFont *pOldFont; // 新添加的老字体资源
font.CreateFontIndirect(&lf);
// memDC.SelectObject(font); // 隐掉
pOldFont = memDC.SelectObject(&font); // 新添加获得老字体资源
//////////////////////////////////////////////////////////////////////////
// 取得字体属性
TEXTMETRIC tm;
memset(&tm,0,sizeof tm);
memDC.GetTextMetrics(&tm);
CSize fs = memDC.GetTextExtent(m_prompt);
int textWidth = fs.cx;//tm.tmAveCharWidth * (m_prompt.GetLength() + 1);
//////////////////////////////////////////////////////////////////////////
// 设置字体颜色
memDC.SetTextColor(m_fontColor);
//////////////////////////////////////////////////////////////////////////
GetWindowRect(&clientRect);
ScreenToClient(&clientRect);
m_edtInput.GetWindowRect(&edtRect);
ScreenToClient(&edtRect);
int x,y;
RECT textRect;
if(clientRect.right > textWidth)
{
x = (clientRect.right - textWidth) / 2;
textRect.left = x;
textRect.right = textRect.left + textWidth;
}
else
{
x = 20;
textRect.left = x;
textRect.right = clientRect.right - 20;
}
//y = (edtRect.top - tm.tmHeight - 2);
y = 5;
memDC.MoveTo(x,y);
textRect.top = y;
textRect.bottom = y + GetTextLineHeight(fs.cy,textRect.right-textRect.left
,fs.cx);
memDC.DrawText(m_prompt,&textRect,DT_WORDBREAK|DT_CENTER);
//////////////////////////////////////////////////////////////////////////
dc.BitBlt(0,0,client.Width(),client.Height(),&memDC,0,0,SRCCOPY);
memDC.SelectObject(pOldFont); // 新添加的把老字体资源选回去
font.DeleteObject();
//brh.DeleteObject();
memDC.SelectObject(oldBkBit);
//.........这里部分代码省略.........
示例8: GetSysColor
//.........这里部分代码省略.........
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_RADIOBUTTON, RBS_UNCHECKEDNORMAL, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, RBS_UNCHECKEDNORMAL, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTONRADIO | DFCS_FLAT);
// radio checked
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*3);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_RADIOBUTTON, RBS_CHECKEDNORMAL, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, RBS_CHECKEDNORMAL, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_FLAT);
// checkbox disabled
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*4);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_CHECKBOX, CBS_UNCHECKEDDISABLED, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, CBS_UNCHECKEDDISABLED, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_INACTIVE | DFCS_FLAT);
// checkbox checked disabled
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*5);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_CHECKBOX, CBS_CHECKEDDISABLED, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, CBS_CHECKEDDISABLED, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_INACTIVE | DFCS_FLAT);
// radio disabled
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*6);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_RADIOBUTTON, RBS_UNCHECKEDDISABLED, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, RBS_UNCHECKEDDISABLED, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTONRADIO | DFCS_INACTIVE | DFCS_FLAT);
// radio checked disabled
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*7);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_RADIOBUTTON, RBS_CHECKEDDISABLED, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, RBS_CHECKEDDISABLED, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTONRADIO | DFCS_CHECKED | DFCS_INACTIVE | DFCS_FLAT);
// checkbox checked tri-state
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*8);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_CHECKBOX, CBS_MIXEDNORMAL, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, CBS_MIXEDNORMAL, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTON3STATE | DFCS_CHECKED | DFCS_FLAT);
// checkbox checked tri-state disabled
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*9);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, BP_CHECKBOX, CBS_MIXEDDISABLED, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, BP_CHECKBOX, CBS_MIXEDDISABLED, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_BUTTON, DFCS_BUTTON3STATE | DFCS_CHECKED | DFCS_INACTIVE | DFCS_FLAT);
ASSERT( TREEOPTSCTRLIMG_EDIT == 11 );
rcBmp.MoveToX(iBmpWidth*11);
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*11);
CFont font;
if (font.CreatePointFont(10, _T("Courier")))
{
CFont* pOldFont = dcMem.SelectObject(&font);
dcMem.TextOut(rcCtrl.left+2, rcCtrl.top, _T("I"));
dcMem.SelectObject(pOldFont);
}
CRect rcEdge(rcBmp);
rcEdge.top += 1;
rcEdge.bottom -= 1;
dcMem.DrawEdge(&rcEdge, EDGE_ETCHED, BF_RECT);
if (hTheme){
g_xpStyle.CloseThemeData(hTheme);
hTheme = NULL;
}
hTheme = (g_xpStyle.IsThemeActive() && g_xpStyle.IsAppThemed()) ? g_xpStyle.OpenThemeData(NULL, L"COMBOBOX") : NULL;
rcCtrl.MoveToX(iCtrlLeft+iBmpWidth*12);
if (hTheme){
g_xpStyle.DrawThemeBackground(hTheme, dcMem, CP_DROPDOWNBUTTON, CBXS_NORMAL, &rcCtrl, NULL);
g_xpStyle.DrawThemeEdge(hTheme, dcMem, CP_DROPDOWNBUTTON, CBXS_NORMAL, &rcCtrl, 0, 0, NULL);
} else
dcMem.DrawFrameControl(&rcCtrl, DFC_SCROLL, DFCS_SCROLLCOMBOBOX | DFCS_FLAT);
dcMem.SelectObject(pOldBmp);
m_ilTree.Add(&bmpControls, RGB(255,0,255));
if (hTheme)
g_xpStyle.CloseThemeData(hTheme);
}
}
}
::ReleaseDC(HWND_DESKTOP, *pDCScreen);
}
}
示例9: freeData
//获取一个字符的点阵信息
int CChannelNameSet::GetBuffer(int ch, int nFont)
{
freeData();
//创建字体。
CFont hFont;
hFont.CreateFont(nFont,0,0,0,
FW_NORMAL,0,
0,0,DEFAULT_CHARSET,
OUT_TT_PRECIS,CLIP_TT_ALWAYS,
PROOF_QUALITY ,DEFAULT_PITCH,
"宋体 ");
//设置字体到当前设备。
CDC*pDC = GetDC();
CFont* pOldFont = pDC->SelectObject( &hFont);
//设置字体图形变换矩阵
MAT2 mat2;
SetMat(&mat2);
GLYPHMETRICS gm;
//获取这个字符图形需要的字节的大小。
DWORD dwNeedSize = pDC->GetGlyphOutline(ch,GGO_BITMAP,&gm,0,NULL,&mat2);
if (dwNeedSize > 0 && dwNeedSize < 0xFFFF)
{
if( ch == '\t' )
return 4 * gm.gmCellIncX;
m_pBuf = (byte*)(malloc(dwNeedSize));
if ( m_pBuf)
{
//获取字符图形的数据到缓冲区。
pDC->GetGlyphOutline(ch,GGO_BITMAP,&gm,dwNeedSize,m_pBuf,&mat2);
m_nWidth = gm.gmBlackBoxX;
m_nHeight = gm.gmBlackBoxY;
}
}
else if( dwNeedSize == 0xFFFFFFFF || dwNeedSize == 0 || ch < 0x21 )
{
//要生成的文字是空格或tab只需返回宽度
if( ch == ' ')
return gm.gmCellIncX;
else if( ch == '\t' )
return 4 * gm.gmCellIncX;
else
{
UINT nSubstituteChar = ' ';
pDC-> GetGlyphOutline( nSubstituteChar, GGO_NATIVE, &gm,
0, NULL, &mat2 );
if( ch < 256 ) //西文
return gm.gmCellIncX;
else //中文空两个空格
return 2*gm.gmCellIncX;
}
}
else
{
dwNeedSize = 0;
}
pDC->SelectObject(pOldFont);
ReleaseDC(pDC);
return dwNeedSize;
}
示例10: strcpy
//.........这里部分代码省略.........
bSearched = false;//假设没有找到。。。
int iik = t;
dX1 = ptArray.GetAt( iik ).x;
dY1 = ptArray.GetAt( iik ).y;
dX2 = ptArray.GetAt( iik + 1 ).x;
dY2 = ptArray.GetAt( iik + 1 ).y;
dX3 = ptArray.GetAt( iik + 2 ).x;
dY3 = ptArray.GetAt( iik + 2 ).y;
double dist = sqrt( ( dX1 - dX2 ) * ( dX1 - dX2 ) + ( dY1 - dY2 ) * ( dY1 - dY2 ) ) + sqrt( ( dX3 - dX2 ) * ( dX3 - dX2 ) + ( dY3 - dY2 ) * ( dY3 - dY2 ) );
double mmk, kkm, xc, yc, ro;
do
{
double pf1 = dX1 * dX1 + dY1 * dY1 - dX2 * dX2 - dY2 * dY2;
double pf2 = dX2 * dX2 + dY2 * dY2 - dX3 * dX3 - dY3 * dY3;
if ( dY1 == dY2 ) goto lbl100;
mmk = pf2 - ( ( dY2 - dY3 ) / ( dY1 - dY2 ) ) * pf1;
kkm = 2 * ( dX2 - dX3 - ( dY2 - dY3 ) * ( dX1 - dX2 ) / ( dY1 - dY2 ) );
if ( abs( kkm ) < 0.0001 ) goto lbl100;
xc = mmk / kkm;//(xc,yc)为园心,ro为半径
yc = ( pf2 - 2 * ( dX1 - dX2 ) * xc ) / ( 2 * ( dY1 - dY2 ) );
ro = sqrt( ( yc - dX2 ) * ( yc - dX2 ) + ( yc - dY2 ) * ( yc - dY2 ) );
if ( ro < myFont.lfHeight * 5 )
{
bSearched = false;
break;
}
lbl100: //如果满足要求的话,继续。。。
bSearched = true;
if ( dist > iWidth ) break;
iik++;
if ( iik + 2 > i - 10 )
{
bSearched = false; //点的个数不够,停止追踪
break;
}
dX1 = dX2;
dY1 = dY2;
dX2 = dX3;
dY2 = dY3;
dX3 = ptArray.GetAt( iik + 2 ).x;
dY3 = ptArray.GetAt( iik + 2 ).y;
dist += sqrt( ( dX3 - dX2 ) * ( dX3 - dX2 ) + ( dY3 - dY2 ) * ( dY3 - dY2 ) );
// dc->Ellipse(ptArray.GetAt(iik+2).x-10,ptArray.GetAt(iik+2).y-10,ptArray.GetAt(iik+2).x+10,ptArray.GetAt(iik+2).y+10);
}
while( 1 );
if ( bSearched == true )
{
kkkmmm = t;
break;
}
}
if ( bSearched == false || kkkmmm == 0 )
{
return;
}
dc->Ellipse( ptArray.GetAt( kkkmmm ).x - 40, ptArray.GetAt( kkkmmm ).y - 40, ptArray.GetAt( kkkmmm ).x + 40, ptArray.GetAt( kkkmmm ).y + 40 );
double xzwz = ptArray.GetAt( kkkmmm ).x;
double yzwz = ptArray.GetAt( kkkmmm ).y;
double dltx = ptArray.GetAt( kkkmmm ).x - ptArray.GetAt( kkkmmm + iNeedDots ).x;
double dlty = ptArray.GetAt( kkkmmm ).y - ptArray.GetAt( kkkmmm + iNeedDots ).y;
double fzqz;
if ( dltx != 0 )
{
fzqz = -atan( dlty / dltx );
if ( dlty == 0 ) fzqz = 0;
}
else
double fzqz = 3 * pie / 2;
bzjd_m = -fzqz;
if ( ( fzqz < pie / 2 && fzqz > 0 ) || ( fzqz < -3 * pie / 2 && fzqz > -2 * pie ) || ( fzqz > pie && fzqz < 3 * pie / 2 ) || ( fzqz > -pie && fzqz < -pie / 2 ) )
{
// xzwz += (sqrt(iHeight*iHeight+iWidth*iWidth)/2 * cos(fzqz - atan(iHeight/iWidth)));
// yzwz += (sqrt(iHeight*iHeight+iWidth*iWidth)/2 * sin(fzqz - atan(iHeight/iWidth)));
//xzwz = xzwz - abs(myFont.lfWidth * cos(fzqz)) - abs(myFont.lfHeight * sin(fzqz) / 2);
// yzwz = yzwz - abs(myFont.lfHeight * cos(fzqz) / 2) + abs(myFont.lfWidth * sin(fzqz));
}
else
{
// xzwz -= (sqrt(iHeight*iHeight+iWidth*iWidth)/2 * cos(fzqz - atan(iHeight/iWidth)));
// yzwz += (sqrt(iHeight*iHeight+iWidth*iWidth)/2 * sin(fzqz - atan(iHeight/iWidth)));
// xzwz = xzwz - abs(myFont.lfWidth * cos(fzqz)) + abs(myFont.lfHeight * sin(fzqz) / 2);
// yzwz = yzwz - abs(myFont.lfHeight * cos(fzqz) / 2) - abs(myFont.lfWidth * sin(fzqz));
}
myFont.lfEscapement = fzqz * 1800 / pie;
//标注
CFont NewFont;
NewFont.CreateFontIndirect( &myFont );
CFont* OrgFont = dc->SelectObject( &NewFont );
dc->TextOut( xzwz, yzwz, TextString, 5 ); //TextString.GetLength());
dc->SelectObject( OrgFont );
NewFont.DeleteObject();
OrgFont->DeleteObject();
}
}
示例11: DrawButton
void CXTPPopupPaintManager::DrawItem(CDC* pDC, CXTPPopupItem* pItem)
{
CRect rc = pItem->GetRect();
if (pItem->GetBackgroundColor() != (COLORREF)-1)
pDC->FillSolidRect(rc, pItem->GetBackgroundColor());
if (pItem->GetBorderColor() != (COLORREF)-1)
pDC->Draw3dRect(rc, pItem->GetBorderColor(), pItem->GetBorderColor());
CXTPImageManagerIcon* pIcon = pItem->GetImage();
if (pIcon)
{
rc.OffsetRect(pItem->GetIconOffset());
if (pItem->IsPressed() && pItem->IsSelected())
{
if (pItem->IsButton())
DrawButton(pDC, pItem);
pIcon->Draw(pDC, rc.TopLeft(), pIcon->GetCheckedIcon());
}
else if (pItem->IsSelected() || pItem->IsPressed())
{
if (pItem->IsButton())
DrawButton(pDC, (CXTPPopupItem*)pItem);
pIcon->Draw(pDC, rc.TopLeft(), pIcon->GetHotIcon());
}
else
{
pIcon->Draw(pDC, rc.TopLeft(), pIcon->GetIcon());
}
return;
}
if (pItem->IsButton())
DrawButton(pDC, (CXTPPopupItem*)pItem);
if (!pItem->GetCaption().IsEmpty())
{
CXTPRichRender* pRichRender = pItem->m_pRichRender;
CFont fntUnderline;
CFont* pFont = pItem->GetTextFont();
if ((pItem->IsSelected() && pItem->IsHyperLink() && pItem->IsUnderline()) || pItem->IsBold())
{
LOGFONT lpLogFont;
pFont->GetLogFont(&lpLogFont);
lpLogFont.lfUnderline = (pItem->IsSelected() && pItem->IsHyperLink() && pItem->IsUnderline());
lpLogFont.lfWeight = pItem->IsBold() ? FW_BOLD : FW_NORMAL;
VERIFY(fntUnderline.CreateFontIndirect(&lpLogFont));
pFont = &fntUnderline;
}
CRect rcText(pItem->GetRect());
CXTPFontDC font(pDC, pFont);
if (pRichRender)
{
pRichRender->DrawText(pDC, rcText);
}
else
{
if ((pItem->GetTextAlignment() & (DT_WORDBREAK | DT_VCENTER)) == (DT_WORDBREAK | DT_VCENTER))
{
CRect rcTextHeight(rcText.left, 0, rcText.right, 0);
pDC->DrawText(pItem->GetCaption(), rcTextHeight, pItem->GetTextAlignment() | DT_CALCRECT);
rcText.top = (rcText.top + rcText.bottom - rcTextHeight.bottom) / 2;
}
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(pItem->GetTextColor() == (COLORREF)-1 ? m_clrText : pItem->GetTextColor());
pDC->DrawText(pItem->GetCaption(), rcText, pItem->GetTextAlignment());
}
}
}
示例12: dc
void CHeaderCtrlCl::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CHeaderCtrl::OnPaint()
int nItem;
nItem = GetItemCount();//得到有几个单元
for(int i = 0; i<nItem;i ++)
{
CRect tRect;
GetItemRect(i,&tRect);//得到Item的尺寸
int R = m_R,G = m_G,B = m_B;
CRect nRect(tRect);//拷贝尺寸到新的容器中
nRect.left++;//留出分割线的地方
//绘制立体背景
for(int j = tRect.top;j<=tRect.bottom;j++)
{
nRect.bottom = nRect.top+1;
CBrush _brush;
_brush.CreateSolidBrush(RGB(R,G,B));//创建画刷
dc.FillRect(&nRect,&_brush); //填充背景
_brush.DeleteObject(); //释放画刷
R-=m_Gradient;G-=m_Gradient;B-=m_Gradient;
if (R<0)R = 0;
if (G<0)G = 0;
if (B<0)B= 0;
nRect.top = nRect.bottom;
}
dc.SetBkMode(TRANSPARENT);
CFont nFont ,* nOldFont;
//dc.SetTextColor(RGB(250,50,50));
dc.SetTextColor(m_color);
nFont.CreateFont(m_fontHeight,m_fontWith,0,0,0,FALSE,FALSE,0,0,0,0,0,0,_TEXT("宋体"));//创建字体
nOldFont = dc.SelectObject(&nFont);
UINT nFormat = 1;
if (m_Format[i]=='0')
{
nFormat = DT_LEFT;
tRect.left+=3;
}
else if (m_Format[i]=='1')
{
nFormat = DT_CENTER;
}
else if (m_Format[i]=='2')
{
nFormat = DT_RIGHT;
tRect.right-=3;
}
TEXTMETRIC metric;
dc.GetTextMetrics(&metric);
int ofst = 0;
ofst = tRect.Height() - metric.tmHeight;
tRect.OffsetRect(0,ofst/2);
dc.DrawText(m_HChar[i],&tRect,nFormat);
dc.SelectObject(nOldFont);
nFont.DeleteObject(); //释放字体
}
//画头部剩余部分
CRect rtRect;
CRect clientRect;
GetItemRect(nItem - 1,rtRect);
GetClientRect(clientRect);
rtRect.left = rtRect.right+1;
rtRect.right = clientRect.right;
int R = m_R,G = m_G,B = m_B;
CRect nRect(rtRect);
//绘制立体背景
for(int j = rtRect.top;j<=rtRect.bottom;j++)
{
nRect.bottom = nRect.top+1;
CBrush _brush;
_brush.CreateSolidBrush(RGB(R,G,B));//创建画刷
dc.FillRect(&nRect,&_brush); //填充背景
_brush.DeleteObject(); //释放画刷
R-=m_Gradient;G-=m_Gradient;B-=m_Gradient;
if (R<0)R = 0;
if (G<0)G = 0;
if (B<0)B= 0;
nRect.top = nRect.bottom;
}
}
示例13: GetWindowText
void CProgressCtrlX::DrawText(const CDrawInfo& info, const CRect &rcMax, const CRect &rcBar)
{
if(!(info.dwStyle&PBS_TEXTMASK))
return;
BOOL fVert = info.dwStyle&PBS_VERTICAL;
CDC *pDC = info.pDC;
int nValue = 0;
CString sFormat;
GetWindowText(sFormat);
switch(info.dwStyle&PBS_TEXTMASK)
{
case PBS_SHOW_PERCENT:
if(sFormat.IsEmpty())
sFormat = "%d%%";
// retrieve current position and range
nValue = (int)((float)(info.nCurPos-info.nLower) * 100 / ((info.nUpper-info.nLower == 0) ? 1 : info.nUpper-info.nLower));
break;
case PBS_SHOW_POSITION:
if(sFormat.IsEmpty())
sFormat = "%d";
// retrieve current position
nValue = info.nCurPos;
break;
}
if (sFormat.IsEmpty())
return;
CFont* pFont = GetFont();
CSelFont sf(pDC, pFont);
CSelTextColor tc(pDC, m_clrTextOnBar);
CSelBkMode bm(pDC, TRANSPARENT);
CSelTextAlign ta(pDC, TA_BOTTOM|TA_CENTER);
CPoint ptOrg = pDC->GetWindowOrg();
CString sText;
sText.Format(sFormat, nValue);
LONG grad = 0;
if(pFont)
{
LOGFONT lf;
pFont->GetLogFont(&lf);
grad = lf.lfEscapement/10;
}
int x = 0, y = 0, dx = 0, dy = 0;
CSize sizText = pDC->GetTextExtent(sText);
if(grad == 0) {
x = sizText.cx;
y = sizText.cy;
dx = 0;
dy = sizText.cy;
}
else if(grad == 90) {
x = sizText.cy;
y = sizText.cx;
dx = sizText.cy;
dy = 0;
}
else if(grad == 180) {
x = sizText.cx;
y = sizText.cy;
dx = 0;
dy = -sizText.cy;
}
else if(grad == 270) {
x = sizText.cy;
y = sizText.cx;
dx = -sizText.cy;
dy = 0;
}
else ASSERT(0); // angle not supported
#if 0
// required "math.h"
double pi = 3.1415926535;
double rad = grad*pi/180;
dx = sz.cy*sin(rad);
dy = sz.cy*cos(rad);
#endif
CPoint pt = pDC->GetViewportOrg();
if(info.dwStyle&PBS_TIED_TEXT)
{
CRect rcFill(ConvertToReal(info, rcBar));
if((fVert ? y : x) <= rcBar.Width())
{
pDC->SetViewportOrg(rcFill.left + (rcFill.Width() + dx)/2,
rcFill.top + (rcFill.Height() + dy)/2);
DrawClippedText(info, rcBar, sText, ptOrg);
}
}
else
{
pDC->SetViewportOrg(info.rcClient.left + (info.rcClient.Width() + dx)/2,
info.rcClient.top + (info.rcClient.Height() + dy)/2);
if(m_clrTextOnBar == m_clrTextOnBk)
// if the same color for bar and background draw text once
DrawClippedText(info, rcMax, sText, ptOrg);
else
{
// else, draw clipped parts of text
//.........这里部分代码省略.........
示例14: CalculateMenuWidth
int MenuFunctions::CalculateMenuWidth(HMENU hMenu)
{
// create a copy of the font that shoule be used to render a menu
NONCLIENTMETRICS nm;
LOGFONT lf;
CFont menuFont;
TCHAR menuItemText[_MAX_PATH];
nm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nm.cbSize,&nm, 0));
lf = nm.lfMenuFont;
menuFont.CreateFontIndirect(&lf);
CDC dc;
dc.Attach(::GetDC(NULL)); // get screen DC
dc.SaveDC();
dc.SelectObject(&menuFont);
// look at each item and work out its width
int maxWidth = 0;
int itemCount = ::GetMenuItemCount(hMenu);
for (int item = 0 ; item < itemCount ; item++)
{
// get each items data
int itemWidth = f_iconWidth + f_menuBorder;
MENUITEMINFO itemInfo;
itemInfo.dwTypeData = menuItemText;
itemInfo.cch = _MAX_PATH - 1;
memset(&itemInfo, 0, sizeof(MENUITEMINFO));
itemInfo.cbSize = sizeof(MENUITEMINFO);
itemInfo.fMask = MIIM_SUBMENU /*| MIIM_STRING*/;
::GetMenuItemInfo(hMenu, item, TRUE, &itemInfo);
if (itemInfo.hSubMenu != 0)
{
// its a popup menu, include the width of the > arrow
itemWidth += f_popupArrowSize;
}
if (itemInfo.wID == 0)
{
// its a separator, dont measure the text
}
else
{
// measure the text using the font
CSize textSize;
CString itemText = menuItemText;
// expand any tabs in the menu text
itemText.Replace("\t", " ");
textSize = dc.GetTextExtent(itemText);
itemWidth += textSize.cx;
}
if (itemWidth > maxWidth)
{
maxWidth = itemWidth;
}
}
dc.RestoreDC(-1);
::ReleaseDC(NULL, dc.Detach());
return maxWidth;
}
示例15: SetPropListFont
void CPropertiesWnd::InitPropList()
{
SetPropListFont();
m_wndPropList.EnableHeaderCtrl(FALSE);
m_wndPropList.EnableDescriptionArea();
m_wndPropList.SetVSDotNetLook();
m_wndPropList.MarkModifiedProperties();
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("外观"));
pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("三维外观"), (_variant_t) false, _T("指定窗口的字体不使用粗体,并且控件将使用三维边框")));
CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("边框"), _T("Dialog Frame"), _T("其中之一: 无(None)、细(Thin)、可调整大小(Resizable)、对话框外框(Dialog Frame)"));
pProp->AddOption(_T("None"));
pProp->AddOption(_T("Thin"));
pProp->AddOption(_T("Resizable"));
pProp->AddOption(_T("Dialog Frame"));
pProp->AllowEdit(FALSE);
pGroup1->AddSubItem(pProp);
pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("标题"), (_variant_t) _T("关于"), _T("指定窗口标题栏中显示的文本")));
m_wndPropList.AddProperty(pGroup1);
CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("窗口大小"), 0, TRUE);
pProp = new CMFCPropertyGridProperty(_T("高度"), (_variant_t) 250l, _T("指定窗口的高度"));
pProp->EnableSpinControl(TRUE, 50, 300);
pSize->AddSubItem(pProp);
pProp = new CMFCPropertyGridProperty( _T("宽度"), (_variant_t) 150l, _T("指定窗口的宽度"));
pProp->EnableSpinControl(TRUE, 50, 200);
pSize->AddSubItem(pProp);
m_wndPropList.AddProperty(pSize);
CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("字体"));
LOGFONT lf;
CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
font->GetLogFont(&lf);
lstrcpy(lf.lfFaceName, _T("宋体, Arial"));
pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("字体"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("指定窗口的默认字体")));
pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("使用系统字体"), (_variant_t) true, _T("指定窗口使用“MS Shell Dlg”字体")));
m_wndPropList.AddProperty(pGroup2);
CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("杂项"));
pProp = new CMFCPropertyGridProperty(_T("(名称)"), _T("应用程序"));
pProp->Enable(FALSE);
pGroup3->AddSubItem(pProp);
CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("窗口颜色"), RGB(210, 192, 254), NULL, _T("指定默认的窗口颜色"));
pColorProp->EnableOtherButton(_T("其他..."));
pColorProp->EnableAutomaticButton(_T("默认"), ::GetSysColor(COLOR_3DFACE));
pGroup3->AddSubItem(pColorProp);
static TCHAR BASED_CODE szFilter[] = _T("图标文件(*.ico)|*.ico|所有文件(*.*)|*.*||");
pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("图标"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("指定窗口图标")));
pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("文件夹"), _T("c:\\")));
m_wndPropList.AddProperty(pGroup3);
CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("层次结构"));
CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("第一个子级"));
pGroup4->AddSubItem(pGroup41);
CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("第二个子级"));
pGroup41->AddSubItem(pGroup411);
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 1"), (_variant_t) _T("值 1"), _T("此为说明")));
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 2"), (_variant_t) _T("值 2"), _T("此为说明")));
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("项 3"), (_variant_t) _T("值 3"), _T("此为说明")));
pGroup4->Expand(FALSE);
m_wndPropList.AddProperty(pGroup4);
}