Esempio n. 1
0
        /// <summary>
        /// Gets the default font for drawing menu items.
        /// </summary>
        /// <note>
        /// If the font cannot be created then a generic
        /// 8 point Sans Serif font is returned.
        /// </note>
        /// <returns></returns>
        public static Font GetMenuFont()
        {
            WinApi.NONCLIENTMETRICS ncm = new WinApi.NONCLIENTMETRICS();
            bool res;

            ncm.cbSize = Marshal.SizeOf(typeof(WinApi.NONCLIENTMETRICS));
            res        = WinApi.Call.SystemParametersInfo(
                WinApi.Constant.SPI_GETNONCLIENTMETRICS, ncm.cbSize,
                ref ncm, 0);

            if (res)
            {
                return(Font.FromLogFont(ncm.lfMenuFont));
            }

            return(new Font(FontFamily.GenericSansSerif, 8));
        }
Esempio n. 2
0
 public static extern bool SystemParametersInfo(int uiAction,
                                                int uiParam, ref NONCLIENTMETRICS pvParam,
                                                int fWinIni);