Ejemplo n.º 1
0
        public void SetFont(Font font)
        {
            var lf = new LogFont();
            font.ToLogFont(lf);
            lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;

            NativeMethods.SendMessage(hIMEWnd, (int) WindowMessage.WM_IME_CONTROL, IMC_SETCOMPOSITIONFONT, lf);
        }
Ejemplo n.º 2
0
        public ICollection EnumFonts()
        {
            var bmp = new Bitmap(10, 10);
            Graphics g = Graphics.FromImage(bmp);

            IntPtr hDC = g.GetHdc();
            Fonts = new Hashtable();
            var lf = new LogFont {lfCharSet = 1};
            FONTENUMPROC callback = CallbackFunc;
            NativeMethods.EnumFontFamiliesEx(hDC, lf, callback, 0, 0);

            g.ReleaseHdc(hDC);
            g.Dispose();
            bmp.Dispose();
            return Fonts.Keys;
        }
Ejemplo n.º 3
0
        public void SetFont(string fontname, float fontsize)
        {
            var tFont = new LogFont
                        {
                            lfItalic = 0,
                            lfStrikeOut = 0,
                            lfUnderline = 0,
                            lfWeight = 400,
                            lfWidth = 0,
                            lfHeight = ((int) (-fontsize*1.3333333333333)),
                            lfCharSet = 1,
                            lfPitchAndFamily = (FIXED_PITCH | FF_MODERN),
                            lfFaceName = fontname
                        };

            LogFont lf = tFont;

            NativeMethods.SendMessage(hIMEWnd, (int) WindowMessage.WM_IME_CONTROL, IMC_SETCOMPOSITIONFONT, lf);
        }
Ejemplo n.º 4
0
 public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, LogFont lParam);