MFC如何修改button的caption字号?
展开全部
参考我写得SDK代码,转换一下就行了。
HFONT hFont = CreateFont(20, 0, 0, 0,
FW_NORMAL,
FALSE,
FALSE,
0,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,
("宋体"));
//创建各个按钮
HWND hwndButtonNew = CreateWindow (TEXT("BUTTON"),
TEXT("新建"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
10, 100,
80, 30,
hwnd,
(HMENU)IDB_NEW,
((LPCREATESTRUCT)lParam)->hInstance,
NULL);
SendMessage(hwndButtonNew, WM_SETFONT, (WPARAM)hFont, TRUE);
HFONT hFont = CreateFont(20, 0, 0, 0,
FW_NORMAL,
FALSE,
FALSE,
0,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,
("宋体"));
//创建各个按钮
HWND hwndButtonNew = CreateWindow (TEXT("BUTTON"),
TEXT("新建"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
10, 100,
80, 30,
hwnd,
(HMENU)IDB_NEW,
((LPCREATESTRUCT)lParam)->hInstance,
NULL);
SendMessage(hwndButtonNew, WM_SETFONT, (WPARAM)hFont, TRUE);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询