public static void GetTextMetrics(Font font, out TEXTMETRIC tm) { using (FontDC dc = new FontDC(font)) { GetTextMetrics(dc.handle, out tm); } }
private static extern bool GetTextMetrics(IntPtr hdc, out TEXTMETRIC lptm);
protected virtual void RebuildFont() { if (font != null) { font.Dispose(); } font = new Font(FontName, FontSize, fontStyle, GraphicsUnit.Pixel); if (font != null) { TextHelper.GetTextMetrics(font, out tm); } else { tm = TEXTMETRIC.Default; } OnFontChanged(EventArgs.Empty); }