高手如何设置属性表(CPropSheet)或者对话框字体,用代码设置

sssn 2006-03-14 11:25:52
rt

用SetFont设置不了,请测试无误后再回答
...全文
168 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sssn 2006-03-16
  • 打赏
  • 举报
回复
对话框怎么用代码设置字体啊?没有人作过吗?
sssn 2006-03-15
  • 打赏
  • 举报
回复
没有更好的办法吗?
Kudeet 2006-03-14
  • 打赏
  • 举报
回复
how to set the desired font for your CPropertyPages in Visual C++
http://support.microsoft.com/kb/142170
sssn 2006-03-14
  • 打赏
  • 举报
回复
有没有简单点的啊,怎么看不明白啊
laiyiling(【CSDN●目标】) ( ) 信誉:528
发的例子是.NET编译的
goodboyws 2006-03-14
  • 打赏
  • 举报
回复
Knowledge Base

HOWTO: Change the Font Used by Dialog Controls in WindowsPSS ID Number: 74737

Article Last Modified on 7/9/2000


--------------------------------------------------------------------------------
The information in this article applies to:


Microsoft Win32 Software Development Kit (SDK)
Microsoft Windows Software Development Kit (SDK) 3.1

--------------------------------------------------------------------------------

This article was previously published under Q74737
SUMMARY
In Windows 3.x, there are two ways to specify the font used by dialog controls:
The FONT statement can be used in the dialog template to specify the font used by ALL the controls in the dialog box.
The WM_SETFONT message can be sent to one or more dialog controls during the processing of the WM_INITDIALOG message.
If a font is specified in the dialog template, the controls will use a bold version of that font. The following code demonstrates how to change the font used by dialog box controls to a nonbold font using WM_SETFONT. The font should be deleted with DeleteObject() when the dialog box is closed.
Sample Code
HWND hDlg;
HFONT hDlgFont;
LOGFONT lFont;

case WM_INITDIALOG:
/* Get dialog font and create non-bold version */
hDlgFont = NULL;
if ((hDlgFont = (HFONT)SendMessage(hDlg, WM_GETFONT, 0, 0L))
!= NULL)
{
if (GetObject(hDlgFont, sizeof(LOGFONT), (LPSTR)&lFont)
!= NULL)
{
lFont.lfWeight = FW_NORMAL;
if ((hDlgFont = CreateFontIndirect(&lFont)) != NULL)
{
SendDlgItemMessage(hDlg, CTR1, WM_SETFONT, hDlgFont, 0L);
// Send WM_SETFONT message to desired controls
}
}
}
else // user did not specify a font in the dialog template
{ // must simulate system font
lFont.lfHeight = 13;
lFont.lfWidth = 0;
lFont.lfEscapement = 0;
lFont.lfOrientation = 0;
lFont.lfWeight = 200; // non-bold font weight
lFont.lfItalic = 0;
lFont.lfUnderline = 0;
lFont.lfStrikeOut = 0;
lFont.lfCharSet = ANSI_CHARSET;
lFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
lFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lFont.lfQuality = DEFAULT_QUALITY;
lFont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
lFont.lfFaceName[0] = NULL;
hDlgFont = CreateFontIndirect(&lFont);

SendDlgItemMessage(hDlg, CTR1, WM_SETFONT, hDlgFont,
(DWORD)TRUE);
// Send WM_SETFONT message to desired controls
}

return TRUE;
break;

Keywords: kbDlg kbhowto KB74737
Technology: kbAudDeveloper kbSDKSearch kbWin32SDKSearch kbWin32sSearch kbWin3xSearch kbWinSDK310 kbWinSDKSearch



--------------------------------------------------------------------------------

Send feedback to Microsoft

© 2003 Microsoft Corporation. All rights reserved.

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧