Beispiel #1
0
        public void Font_AdjustForVerticalAlignment(string family, float size, Rectangle bounds, uint dt, Rectangle expected)
        {
            using Font font = new Font(family, size);
            if (font.Name != family)
            {
                // Not installed on this machine
                return;
            }

            using WindowsFont windowsFont = WindowsFont.FromFont(font, Gdi32.QUALITY.CLEARTYPE);
            WindowsGraphics graphics = WindowsGraphicsCacheManager.MeasurementGraphics;

            graphics.DeviceContext.SelectFont(windowsFont);
            User32.DRAWTEXTPARAMS param  = default;
            Rectangle             result = WindowsGraphics.AdjustForVerticalAlignment(
                graphics,
                "Windows Foundation Classes",
                bounds,
                (User32.DT)dt,
                ref param);

            Assert.Equal(expected, result);
        }