private void AddCaptionFonts(ResourceDictionary newDictionary) { NONCLIENTMETRICS nONCLIENTMETRICS = default(NONCLIENTMETRICS); nONCLIENTMETRICS.cbSize = Marshal.SizeOf(typeof(NONCLIENTMETRICS)); if (!NativeMethods.SystemParametersInfo(41, nONCLIENTMETRICS.cbSize, ref nONCLIENTMETRICS, 0)) { newDictionary.Add("VsFont.CaptionFontFamily", this["VsFont.EnvironmentFontFamilyKey"]); newDictionary.Add("VsFont.CaptionFontSize", this["VsFont.EnvironmentFontSizeKey"]); newDictionary.Add("VsFont.CaptionFontWeight", FontWeights.Normal); return; } FontFamily captionFont = new FontFamily(nONCLIENTMETRICS.lfCaptionFont.lfFaceName); double captionSize = FontSizeFromLOGFONTHeight(nONCLIENTMETRICS.lfCaptionFont.lfHeight); FontWeight fontWeight = FontWeight.FromOpenTypeWeight(nONCLIENTMETRICS.lfCaptionFont.lfWeight); newDictionary.Add("VsFont.CaptionFontFamily", captionFont); newDictionary.Add("VsFont.CaptionFontSize", captionSize); newDictionary.Add("VsFont.CaptionFontWeight", fontWeight); }
internal static extern bool SystemParametersInfo(int uiAction, int uiParam, ref NONCLIENTMETRICS pvParam, int fWinIni);