Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想拥有/自定义绘制按钮的文本,但只有文本(或内容)。所以我可以用多种彩色字体渲染按钮。
如果我处理WM_DRAWITEM,我必须绘制整个按钮。我只想绘制文本。
WM_DRAWITEM
是否可以调用一些 API 让 Windows 绘制没有文本的按钮,然后我可以自己绘制文本?
您必须自己绘制整个按钮。但是,如果在 XP+ 上启用了 CommCtrl v6,您可以使用该DrawFrameControl()函数或DrawThemeParentBackground/Ex()andDrawThemeBackground/Ex()函数,让 Windows 为您绘制按钮的背景和边框。然后,您可以在其上绘制所需的文本。
DrawFrameControl()
DrawThemeParentBackground/Ex()
DrawThemeBackground/Ex()