c++ - 如何在win api中设置整个应用程序的字体?

标签 c++ winapi fonts

<分区>

Possible Duplicates:
How to set default font for all the windows in a Win32 Application?
Which Font is the default for MFC Dialog Controls?

我讨厌默认的 Windows Api 窗口字体(我认为它是默认的系统字体)。我知道如何改变单个 child 的字体,比如一个按钮。但是有没有办法更改整个应用程序的字体,这样我就不必在程序中的每个小部件上都使用 SendMessage(...WM_SETFONT)

欢迎使用代码示例。 (我正在使用 C++)

最佳答案

一种方法是使用 EnumChildWindows :

BOOL CALLBACK SetChildFont(HWND hwndChild, LPARAM lParam)
{
    HFONT hFont = (HFONT)lParam;
    SendMessage(hwndChild, WM_SETFONT, (WPARAM)hFont, TRUE);
}

EnumChildWindows(hwndParent, SetChildFont, (LPARAM)hFont);

关于c++ - 如何在win api中设置整个应用程序的字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6724483/

相关文章:

c++ - 使用 Qt 4 创建桌面小部件(如 Yahoo Widgets 或 Google Gadgets)

c++ - 如何在线程中确定用户定义消息的优先级?

c++ - 在不同的文件中模板化模板实例化

c++ - 用记录集填充 TreeView

css - Font Awesome : Why isn't my arrow icon loading on an :after instance?

css - 浏览器如何缩放位图字体?

c++ - 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error>>

c - minGW项目中w32api有什么用

c - 从一个程序执行和捕获另一个程序

html - 谷歌字体@import + @font-face?