none
How to set font of edit box RRS feed

  • Question

  • How do you set the font for a particular edit box

    ' Create window
    hWnd = CreateWindowEx( 0, "#32770", "Window Title", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, 100, 100, 600, 600, 0, 0, 0, 0 )

    'create in edit
    EDIT_IN  = CreateWindowEx( 0, "EDIT", "", WS_VISIBLE Or WS_CHILD Or WS_BORDER or ES_MULTILINE or WS_VSCROLL or WS_HSCROLL               , 10, 10,430,110, hWnd, 0, 0, 0 )

    I need to set the edit box font to "system" to be able to show all 256 chars..

    Monday, May 25, 2015 9:16 PM

All replies

  • Try this:

    HFONT font = (HFONT)GetStockObject( SYSTEM_FONT );
    SendMessage( EDIT_IN, WM_SETFONT, (WPARAM)font, TRUE );

    To use a particular font by name, consider CreateFont.

    Wednesday, May 27, 2015 4:31 AM