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 "TEXTMETRIC" in [All]

Structures

.
Summary
.

public struct OUTLINETEXTMETRIC

.

    public TEXTMETRIC otmTextMetrics;

.

    Private Structure OUTLINETEXTMETRIC

.

        Public otmTextMetrics As TEXTMETRIC

.

TEXTMETRIC

.
Documentation
[OUTLINETEXTMETRIC] on MSDN
.
Remarks
Always be explicit which character set you want to use. Use either TEXTMETRICA with the character set Ansi or TEXTMETRICW with the character set Unicode. Avoid the use of Auto as it is platform dependent and might cause memory leaks.
.

public struct TEXTMETRIC

.

public struct TEXTMETRICW

.

public struct TEXTMETRICA

.

Public Structure TEXTMETRIC

.

Public Structure TEXTMETRICW

.

Public Structure TEXTMETRICA

.
Documentation
[TEXTMETRIC] on MSDN

uxtheme

.

public extern static Int32 GetThemeTextMetrics(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, out TEXTMETRIC textMetric);

.

Declare Function GetThemeTextMetrics Lib "uxtheme.dll" (TODO) As TODO

.

Public Shared Function GetThemeTextMetrics(hTheme As IntPtr, hdc As IntPtr, iPartId As Integer, iStateId As Integer, ByRef textMetric As TEXTMETRIC) As Int32

.
Documentation
[GetThemeTextMetrics] on MSDN

gdi32

.

    public struct NEWTEXTMETRIC

.

    public struct NEWTEXTMETRICEX

.

    NEWTEXTMETRIC ntmTm;

.

    public delegate int EnumFontExDelegate(ref ENUMLOGFONTEX lpelfe, ref NEWTEXTMETRICEX lpntme, int FontType, int lParam);

.

    public int callback1(ref ENUMLOGFONTEX lpelfe, ref NEWTEXTMETRICEX lpntme, int FontType, int lParam)

.

        public struct TEXTMETRIC

.

        public struct NEWTEXTMETRIC

.

            public NEWTEXTMETRIC TextMetric;

.

        public delegate Int32 FONTENUMPROC(ref ENUMLOGFONT lpelf, ref NEWTEXTMETRIC lpntm, UInt32 FontType, IntPtr lParam);

.

        public static int EnumFontFamExProc(ref ENUMLOGFONT lpelf, ref NEWTEXTMETRIC lpntm, uint FontType, IntPtr lParam)

.

            allFontData.Add(new FontData() { LogFont = lpelf, TextMetric = lpntm, FontType = FontType });

.

    public struct NEWTEXTMETRIC

.

    public struct NEWTEXTMETRICEX

.

    NEWTEXTMETRIC ntmTm;

.

    public delegate int EnumFontExDelegate(ref ENUMLOGFONTEX lpelfe, ref NEWTEXTMETRICEX lpntme, int FontType, int lParam);

.

    public int callback1(ref ENUMLOGFONTEX lpelfe, ref NEWTEXTMETRICEX lpntme, int FontType, int lParam)

.

        public struct TEXTMETRIC

.

        public struct NEWTEXTMETRIC

.

            public NEWTEXTMETRIC TextMetric;

.

        public delegate Int32 FONTENUMPROC(ref ENUMLOGFONT lpelf, ref NEWTEXTMETRIC lpntm, UInt32 FontType, IntPtr lParam);

.

        public static int EnumFontFamExProc(ref ENUMLOGFONT lpelf, ref NEWTEXTMETRIC lpntm, uint FontType, IntPtr lParam)

.

            allFontData.Add(new FontData() { LogFont = lpelf, TextMetric = lpntm, FontType = FontType });

.
Summary
.

static extern uint GetOutlineTextMetrics(IntPtr hdc, uint cbData, IntPtr ptrZero);

.

OUTLINETEXTMETRIC

.

Since otmpFamilyName, otmpFaceName, otmpStyleName, otmpFullName are actually offsets into the structure from the beginning of the structure you need double call GetOutlineTextMetrics.

.
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.)
.

    uint cbBuffer = GetOutlineTextMetrics(hdc, 0, IntPtr.Zero);

.

        if (GetOutlineTextMetrics(hdc, cbBuffer, buffer) != 0)

.

            OUTLINETEXTMETRIC otm = new OUTLINETEXTMETRIC();

.

            otm = (OUTLINETEXTMETRIC)Marshal.PtrToStructure(buffer, typeof(OUTLINETEXTMETRIC));

.
Documentation
[GetOutlineTextMetrics] on MSDN
.
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);

.

TEXTMETRIC

.

It's very important to use the same charset on the TEXTMETRIC structure and the extern function.

.

public static TEXTMETRIC GetTextMetrics(Graphics graphics, Font font)

.

   TEXTMETRIC textMetric;

.

     bool result = GetTextMetrics(hDC, out textMetric);

.

   return textMetric;

.

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

.

internal struct TEXTMETRIC

.

public ref struct TEXTMETRIC

.

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

.

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

.

   TEXTMETRIC^ textMetric = gcnew TEXTMETRIC;

.

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

.

   return textMetric;

.
Documentation
[GetTextMetrics] on MSDN

 
Access PInvoke.net directly from VS: