public Font GetFont(IDeviceContext dc, FontProperty prop) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } //valid values are 0xa29 to 0xa29 if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)FontProperty.GlyphFont, (int)FontProperty.GlyphFont)) { throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(FontProperty)); } User32.LOGFONTW logfont = new User32.LOGFONTW(); using (WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties)) { HandleRef hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); lastHResult = UxTheme.GetThemeFont(new HandleRef(this, Handle), hdc, part, state, (int)prop, ref logfont); } Font font = null; //check for a failed HR. if (lastHResult.Succeeded()) { try { font = Font.FromLogFont(logfont); } catch (Exception e) { if (ClientUtils.IsSecurityOrCriticalException(e)) { throw; } //Looks like the font was not true type font = null; } } return(font); }