Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than gdi32, prefix the name with the module name and a period.
int ret = 0;
try
{
//If anyone knows of a better way to get the pointer please let me know
var pictureBox = new PictureBox();
var graphic = pictureBox.CreateGraphics();
var ptr = graphic.GetHdc();
del1 = new EnumFontExDelegate(callback1);
ret = EnumFontFamiliesEx(ptr, plogFont, del1, IntPtr.Zero, 0);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public class LOGFONT
{
public int lfHeight;
public int lfWidth;
public int lfEscapement;
public int lfOrientation;
public FontWeight lfWeight;
[MarshalAs(UnmanagedType.U1)]
public bool lfItalic;
[MarshalAs(UnmanagedType.U1)]
public bool lfUnderline;
[MarshalAs(UnmanagedType.U1)]
public bool lfStrikeOut;
public FontCharSet lfCharSet;
public FontPrecision lfOutPrecision;
public FontClipPrecision lfClipPrecision;
public FontQuality lfQuality;
public FontPitchAndFamily lfPitchAndFamily;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string lfFaceName;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct NEWTEXTMETRIC
{
public int tmHeight;
public int tmAscent;
public int tmDescent;
public int tmInternalLeading;
public int tmExternalLeading;
public int tmAveCharWidth;
public int tmMaxCharWidth;
public int tmWeight;
public int tmOverhang;
public int tmDigitizedAspectX;
public int tmDigitizedAspectY;
public char tmFirstChar;
public char tmLastChar;
public char tmDefaultChar;
public char tmBreakChar;
public byte tmItalic;
public byte tmUnderlined;
public byte tmStruckOut;
public byte tmPitchAndFamily;
public byte tmCharSet;
int ntmFlags;
int ntmSizeEM;
int ntmCellHeight;
int ntmAvgWidth;
}
public struct FONTSIGNATURE
{
[MarshalAs(UnmanagedType.ByValArray)]
int[] fsUsb;
[MarshalAs(UnmanagedType.ByValArray)]
int[] fsCsb;
}
public struct NEWTEXTMETRICEX
{
NEWTEXTMETRIC ntmTm;
FONTSIGNATURE ntmFontSig;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ENUMLOGFONTEX
{
public LOGFONT elfLogFont;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
public string elfFullName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string elfStyle;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string elfScript;
}
public delegate int EnumFontExDelegate(ref ENUMLOGFONTEX lpelfe, ref NEWTEXTMETRICEX lpntme, int FontType, int lParam);
public EnumFontExDelegate del1;
public int callback1(ref ENUMLOGFONTEX lpelfe, ref NEWTEXTMETRICEX lpntme, int FontType, int lParam)
{
try
{
FontType fontType;
if (FontType == 2 || FontType == 4)
{
fontType = (ClientTools.Fonts.FontType)FontType;
}
else
{
fontType = ClientTools.Fonts.FontType.Unknown;
}
The LOGFONT structure defines the attributes of a font.
11/3/2015 6:42:15 PM - -194.25.158.132
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).