gpt4 book ai didi

c++ - 删除字体对象

转载 作者:太空宇宙 更新时间:2023-11-04 13:21:27 25 4
gpt4 key购买 nike

在用 C/C++ 创建一个简单的 Win32 应用程序后,我向控件发送一条消息,以便使用以下 API 应用一些漂亮的字体:

SendMessage(hwndEdit, WM_SETFONT, WPARAM(hFont), TRUE);

之后是否需要删除这个字体对象?删除在 WM_DESTROY 消息中执行。

case WM_DESTROY:
DeleteObject(hFont); // Delete font object
PostQuitMessage(0);
break;

最佳答案

WM_SETFONT message 的文档似乎很清楚这一点:

The application should call the DeleteObject function to delete the font when it is no longer needed; for example, after it destroys the control.

所以,是的,您应该在创建控件的对象的 WM_DESTROY 处理程序中调用 DeleteObject

关于c++ - 删除字体对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35115327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com