库存属性Font的字体字号等怎么调用及设置?UP者有分 我用ATL做的控件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用COleControl::SelectStockFont函数,如添加了库存FONT属性后,在OnDraw中如下 CFont* pOldFont; TEXTMETRIC tm; const CString& strCaption = InternalGetText(); pOldFont = SelectStockFont( pdc ); pdc->FillRect(rcBounds, CBrush::FromHandle( (HBRUSH )GetStockObject(WHITE_BRUSH))); pdc->Ellipse(rcBounds); pdc->GetTextMetrics(&tm); pdc->SetTextAlign(TA_CENTER | TA_TOP); pdc->ExtTextOut((rcBounds.left + rcBounds.right) / 2, (rcBounds.top + rcBounds.bottom - tm.tmHeight) / 2, ETO_CLIPPED, rcBounds, strCaption, strCaption.GetLength(), NULL); pdc->SelectObject(pOldFont); 还有一种方法 { IFontDisp* pFontDisp = NULL; IFont *pFont = NULL; HRESULT hr; // Get the container's FontDisp interface pFontDisp = AmbientFont(); if (pFontDisp) { hr = pFontDisp->QueryInterface(IID_IFont, (LPVOID *) &pFont); if (FAILED(hr)) { pFontDisp->Release(); return; } } HFONT hFont = NULL; if (pFont) { pFont->get_hFont(&hFont); 。 } pFontDisp->Release(); } 或者使用LPFONTDISP GetFont( );void SetFont( LPFONTDISP pFontDisp );取得IFontDisp指针,调用和上面相同 如何改变打开文件对话框的样式? 打开一个新窗口的问题(IE) 谁能帮我解决,500分奉上 学好VC必须要先学好C++吗? 在一个CEdit控间中如何获取Enter 键消息,如何获取ctrl+a+c 组合键消息(答对有分) 面对vc许多API函数,咋办呢! 请教:主程序调用DLL中的函数,DLL函数运行出错,如何保护主程序不受牵连? PINVOKE DLL 错误 在线求解 请问一个view类有4千行,应不算太多,可是为什么编辑操作很慢, 请问‘系统调用’与‘API’ ,‘库例程’ 三者之间的关系。 怎么取一个指定文件的版本信息? 散分
TEXTMETRIC tm;
const CString& strCaption = InternalGetText(); pOldFont = SelectStockFont( pdc );
pdc->FillRect(rcBounds, CBrush::FromHandle(
(HBRUSH )GetStockObject(WHITE_BRUSH)));
pdc->Ellipse(rcBounds);
pdc->GetTextMetrics(&tm);
pdc->SetTextAlign(TA_CENTER | TA_TOP);
pdc->ExtTextOut((rcBounds.left + rcBounds.right) / 2,
(rcBounds.top + rcBounds.bottom - tm.tmHeight) / 2,
ETO_CLIPPED, rcBounds, strCaption, strCaption.GetLength(),
NULL); pdc->SelectObject(pOldFont);
{
IFontDisp* pFontDisp = NULL;
IFont *pFont = NULL;
HRESULT hr; // Get the container's FontDisp interface
pFontDisp = AmbientFont();
if (pFontDisp)
{
hr = pFontDisp->QueryInterface(IID_IFont, (LPVOID *) &pFont);
if (FAILED(hr))
{
pFontDisp->Release();
return;
}
} HFONT hFont = NULL;
if (pFont)
{
pFont->get_hFont(&hFont);
。
} pFontDisp->Release();
}
LPFONTDISP GetFont( );
void SetFont( LPFONTDISP pFontDisp );
取得IFontDisp指针,调用和上面相同