示例#1
0
        public NonClientMetrics(NONCLIENTMETRICS AData)
        {
            this.Data = AData;

            this.CaptionFontFamily = AData.lfCaptionFont.lfFaceName;
            // returns negative, sometimes
            this.CaptionFontSize = System.Math.Abs(AData.lfCaptionFont.lfHeight);
        }
示例#2
0
 static extern bool SystemParametersInfo(int action,
                                         int intParam,
                                         ref NONCLIENTMETRICS metrics,
                                         int update);
示例#3
0
        public static bool readMetrics(out NonClientMetrics thisMetrics)
        {
            bool Result = false;

            /* out */
            thisMetrics = null;

            NONCLIENTMETRICS metrics = new NONCLIENTMETRICS();
            metrics.cbSize = Marshal.SizeOf(metrics);

            Result =
                SystemParametersInfo(
                    SPI_GETNONCLIENTMETRICS,
                    0,
                    ref metrics,
                    0);

            // nota: "SystemParametersInfo" con "CharSet.Unicode",
            // y "LOGFONT" y "LOGFONT" con "CharSet.Auto", es el que funciona
            if (Result)
            {
                thisMetrics = new NonClientMetrics(metrics);
            }

            return Result;
        }