WM_SETFONT

This message is sent by an application to specify the font that a control is to use when drawing text.

WM_SETFONT wParam = (WPARAM) hfont; 
lParam = MAKELPARAM(fRedraw,0);

Parameters

  • hfont
    Handle to the font. If this parameter is NULL, the control uses the default system font to draw text.
  • fRedraw
    Specifies whether the control should be redrawn immediately upon setting the font. If set to TRUE, the control to redraw itself.

Return Values

None.

Remarks

Dialog boxes do not support DS_SETFONT. Applications can set the font for their controls manually.

The WM_SETFONT message applies to all controls, not just those in dialog boxes.

The best time for the owner of a dialog box control to set the font of the control is when it receives the WM_INITDIALOG 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.

The size of the control does not change as a result of receiving this message. To avoid clipping text that does not fit within the boundaries of the control, the application should correct the size of the control window before it sets the font.

When a dialog box uses the DS_SETFONT style to set the text in its controls, the system sends the WM_SETFONT message to the dialog box procedure before it creates the controls. An application can create a dialog box that contains the DS_SETFONT style by calling any of the following functions:

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 1.0 and later Winuser.h    

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CreateDialogIndirect, CreateDialogIndirectParam, DeleteObject, DialogBoxIndirect, DialogBoxIndirectParam, WM_INITDIALOG, DLGTEMPLATE

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.