Partager via


CDC::GetOutputCharWidth

Uses the output device context, m_hDC, and retrieves the widths of individual characters in a consecutive group of characters from the current font.

BOOL GetOutputCharWidth(
   UINT nFirstChar,
   UINT nLastChar,
   LPINT lpBuffer 
) const;

Parameters

  • nFirstChar
    Specifies the first character in a consecutive group of characters in the current font.

  • nLastChar
    Specifies the last character in a consecutive group of characters in the current font.

  • lpBuffer
    Points to a buffer that will receive the width values for a consecutive group of characters in the current font.

Return Value

Nonzero if the function is successful; otherwise 0.

Remarks

For example, if nFirstChar identifies the letter 'a' and nLastChar identifies the letter 'z', the function retrieves the widths of all lowercase characters.

The function stores the values in the buffer pointed to by lpBuffer. This buffer must be large enough to hold all of the widths; that is, there must be at least 26 entries in the example given.

If a character in the consecutive group of characters does not exist in a particular font, it will be assigned the width value of the default character.

Requirements

Header: afxwin.h

See Also

Reference

CDC Class

Hierarchy Chart

CDC::GetCharWidth

CDC::m_hAttribDC

CDC::m_hDC

GetCharWidth

Other Resources

CDC Members