Exemple #1
0
        private void CreateVerticalFont()
        {
            if (_fontHandle != IntPtr.Zero)
            {
                Win32Declarations.DeleteObject(_fontHandle);
                _fontHandle = IntPtr.Zero;
            }

            int logPixY;

            using (Graphics g = CreateGraphics())
            {
                IntPtr hdc = g.GetHdc();
                logPixY = Win32Declarations.GetDeviceCaps(hdc, Win32Declarations.LOGPIXELSY);
                g.ReleaseHdc(hdc);
            }

            _fontHandle = Win32Declarations.CreateFont((int)(-Font.SizeInPoints * logPixY / 72),
                                                       0, _angle * 10, 0, Win32Declarations.FW_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0, Font.Name);
        }