tags:

views:

36

answers:

1

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 = (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));
}
+3  A: 
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.

Matthew T. Staebler
thanks that did it!
Milo