Help Center

AfxModifyFontSettingsfunction

Modifies settings of the font used by a window of control.

WindowsfunctionAfxWin.incdocumented

Syntax

FUNCTION AfxModifyFontSettings (BYVAL hwnd AS HWND, BYVAL nSetting AS LONG, BYVAL nValue AS LONG) AS HFONT

Parameters

NameDescription
hwndHandle to the window or control.
nSettingOne of the AFX_FONT_xxx constants (see below).
nValueDepends of the nSetting value. AFX_FONT_HEIGHT : The base is 100. To increase the font a 20% pass 120; to reduce it a 20% pass 80%.
AFX_FONT_WEIGHT : The weight of the font in the range 0 through 1000. For example, 400 is normal and 700 is bold. If this value is zero, a default weight is used. The following values are defined for convenience. FW_DONTCARE (0), FW_THIN (100), FW_EXTRALIGHT (200), FW_ULTRALIGHT (200), FW_LIGHT (300), FW_NORMAL (400), FW_REGULAR (400), FW_MEDIUM (500), FW_SEMIBOLD (600), FW_DEMIBOLD (600), FW_BOLD (700), FW_EXTRABOLD (800), FW_ULTRABOLD (800), FW_HEAVY (900), FW_BLACK (900)
AFX_FONT_ITALIC : TRUE or FALSE.
AFX_FONT_UNDERLINE : TRUE or FALSE.
AFX_FONT_STRIKEOUT : TRUE or FALSE.
AFX_FONT_CHARSET: The following values are predefined: ANSI_CHARSET, BALTIC_CHARSET, CHINESEBIG5_CHARSET, DEFAULT_CHARSET, EASTEUROPE_CHARSET, GB2312_CHARSET, GREEK_CHARSET, HANGUL_CHARSET, MAC_CHARSET, OEM_CHARSET, RUSSIAN_CHARSET, SHIFTJIS_CHARSET, SYMBOL_CHARSET, TURKISH_CHARSET, VIETNAMESE_CHARSET, JOHAB_CHARSET (Korean language edition of Windows), ARABIC_CHARSET and HEBREW_CHARSET (Middle East language edition of Windows), THAI_CHARSET (Thai language edition of Windows). The OEM_CHARSET value specifies a character set that is operating-system dependent. DEFAULT_CHARSET is set to a value based on the current system locale. For example, when the system locale is English (United States), it is set as ANSI_CHARSET.

Return value

The handle of the new font on success, or NULL on failure.

To get extended error information call GetLastError.

Description

Modifies settings of the font used by a window of control.

Remarks

The returned font must be destroyed with DeleteObject or the macro DeleteFont when no longer needed to prevent memory leaks.

Reference

  • Include file AfxWin.inc
  • Defined in AfxNova/AfxWin.inc:3581
  • Documented in Windows/Windows Procedures.md
  • Topic: Windows Procedures