Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy

Search Results for "GetTextMetrics" in [All]

gdi32

.
Warning
The OUTLINETEXTMETRIC structure includes a TEXTMETRIC structure which includes some TCHAR fields. A TCHAR can compile to a 16 bit character or a 8 bit character (depending on whether UNICODE is defined). The C# version of the TEXTMETRIC structure on PInvoke.net assumes that the TCHAR is a 16 bit character and when you retrieve a TEXTMETRIC structure with GetTextMetrics you do get a TEXTMETRIC structure with 16 bit characters. However, when you retrive an OUTLINETEXTMETRIC structure with GetOutlineTextMetrics the included TEXTMETRIC structure appears to have 8 bit characters. (These observations were with Windows XP and might not hold true for other operating systems or all fonts.)
.
Summary
.

static extern bool GetTextMetrics(IntPtr hdc, out TEXTMETRIC lptm);

.

private static extern bool GetTextMetricsW(IntPtr hdc, out TEXTMETRICW lptm);

.

private static extern bool GetTextMetricsA(IntPtr hdc, out TEXTMETRICA lptm);

.

public static TEXTMETRIC GetTextMetrics(Graphics graphics, Font font)

.

     bool result = GetTextMetrics(hDC, out textMetric);

.

static extern bool GetTextMetrics(IntPtr hdc, out TEXTMETRIC lptm);

.

static bool GetTextMetrics(IntPtr hdc, [Out] TEXTMETRIC% lptm);

.

TEXTMETRIC^ GetTextMetricsReal(Graphics^ g, Font^ font)

.

      bool result = Win32::GetTextMetrics(hDC, *textMetric);

.
Documentation
[GetTextMetrics] on MSDN

 
Access PInvoke.net directly from VS: