Beispiel #1
0
        public GDIFont(string faceName, int height, bool bold, bool italic, bool underline, bool strickout)
        {
            _Font             = new LOGFONT();
            _Font.lfHeight    = height;
            _Font.lfFaceName  = faceName;
            _Font             = new LOGFONT();
            _Font.lfHeight    = height;
            _Font.lfFaceName  = faceName;
            _Font.lfWeight    = bold ? 700 : 400;
            _Font.lfItalic    = italic ? (byte)1 : (byte)0;
            _Font.lfUnderline = underline ? (byte)1:(byte)0;
            _Font.lfStrikeOut = strickout ? (byte)1 : (byte)0;

            base.intHandle = CreateFont(
                _Font.lfHeight,
                _Font.lfWidth,
                _Font.lfEscapement,
                _Font.lfOrientation,
                _Font.lfWeight,
                _Font.lfItalic,
                _Font.lfUnderline,
                _Font.lfStrikeOut,
                1,
                _Font.lfOutPrecision,
                _Font.lfClipPrecision,
                _Font.lfQuality,
                _Font.lfPitchAndFamily,
                _Font.lfFaceName);
        }
Beispiel #2
0
        public GDIFont(Font font)
        {
            float fontSizeInLayoutUnits = font.Size;// CalculateFontSizeInLayoutUnits(font);

            _Font = new LOGFONT();
            font.ToLogFont(_Font);
            _Font.lfHeight = (int)-Math.Round(fontSizeInLayoutUnits / 1f);
            base.intHandle = CreateFont(
                _Font.lfHeight,
                _Font.lfWidth,
                _Font.lfEscapement,
                _Font.lfOrientation,
                _Font.lfWeight,
                _Font.lfItalic,
                _Font.lfUnderline,
                _Font.lfStrikeOut,
                1,
                _Font.lfOutPrecision,
                _Font.lfClipPrecision,
                _Font.lfQuality,
                _Font.lfPitchAndFamily,
                _Font.lfFaceName);
        }
Beispiel #3
0
 public static extern int CreateFontIndirectA(ref LOGFONT lf);
Beispiel #4
0
 public static extern int GetObject(System.IntPtr hgdiobj, int cbBuffer, out LOGFONT lpvObject);