Example #1
0
        /// <summary>
        /// Gets the font provided by the VS environment for dialog UI.
        /// </summary>
        /// <returns>Dialog font, or null if it is not available.</returns>
        public static Font GetDialogFont()
        {
            IUIHostLocale uiHostLocale = WixHelperMethods.GetServiceNoThrow <IUIHostLocale, IUIHostLocale>(WixPackage.Instance);

            if (uiHostLocale != null)
            {
                UIDLGLOGFONT[] pLOGFONT = new UIDLGLOGFONT[1];
                if (uiHostLocale.GetDialogFont(pLOGFONT) == 0)
                {
                    return(Font.FromLogFont(pLOGFONT[0]));
                }
            }

            return(null);
        }