开发者

Update Text Field after font change (Win32)

After I use setcontrolfont, the text of the text field does not update. The onnly way I fixed this is by removing then readding all text but this seems hackish. How can I do it properly? Thanks

*its a function I made:

void SetControlFont(HWND hand, int size, char* name)
{
    HGDIOBJ hfDefault;
    hfDefault开发者_JAVA技巧 = (HGDIOBJ)CreateFontA(size, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,name);
    SendMessage(hand, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
}


SendMessage(hand, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0))

The MAKELPARAM(FALSE, 0) is telling the window that it should not redraw itself. Have you tried using MAKELPARAM(TRUE, 0) instead?


If you do not want to change the SetControlFont function, you could tell the text field to redraw itself after calling SetControlFont by calling RedrawWindow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜