CDC::GetTextExtent

CSizeGetTextExtent(LPCTSTRlpszString**,intnCount)const;**

CSize GetTextExtent( const CString& str ) const;

Return Value

The dimensions of the string (in logical units) in a CSize object.

Parameters

lpszString

Points to a string of characters. You can also pass a CString object for this parameter.

nCount

Specifies the number of characters in the string.

str

 A CString object that contains the specified characters.

Remarks

Call this member function to compute the width and height of a line of text using the current font to determine the dimensions. The information is retrieved from m_hAttribDC, the attribute device context.

The current clipping region does not affect the width and height returned by GetTextExtent.

Since some devices do not place characters in regular cell arrays (that is, they carry out kerning), the sum of the extents of the characters in a string may not be equal to the extent of the string.

CDC OverviewClass MembersHierarchy Chart

See Also   CDC::GetTabbedTextExtent, CDC::m_hAttribDC, CDC::m_hDC, CDC::GetOutputTextExtent, CDC::SetTextJustification, CSize