コード例 #1
0
ファイル: DrawingFont.cs プロジェクト: ForNeVeR/pnet
        private void CreateFont()
        {
            properties.FontFamily.GetEmHeight(properties.Style);
            Win32.Api.LOGFONT lf = new Win32.Api.LOGFONT();
            lf.lfHeight   = (int)(-properties.SizeInPoints * dpi / 75);
            lf.lfFaceName = properties.FontFamily.Name;
            switch (properties.Style)
            {
            case (FontStyle.Bold):
                lf.lfWeight = 600;
                break;

            case (FontStyle.Italic):
                lf.lfItalic = 1;
                break;

            case (FontStyle.Strikeout):
                lf.lfStrikeout = 1;
                break;

            case (FontStyle.Underline):
                lf.lfUnderline = 1;
                break;
            }

            // Don't know why but the next flag makes Windows text look ugly
            // lf.lfQuality = Win32.Api.FontQuality.CLEARTYPE_QUALITY;

            hFont = Win32.Api.CreateFontIndirectA(ref lf);
        }
コード例 #2
0
	private void CreateFont()
	{
		properties.FontFamily.GetEmHeight(properties.Style);
		Win32.Api.LOGFONT lf = new Win32.Api.LOGFONT();
		lf.lfHeight=(int)(-properties.SizeInPoints*dpi/75);
		lf.lfFaceName=properties.FontFamily.Name;
		switch (properties.Style)
		{
			case(FontStyle.Bold):
				lf.lfWeight = 600;
				break;
			case(FontStyle.Italic):
				lf.lfItalic = 1;
				break;
			case(FontStyle.Strikeout):
				lf.lfStrikeout = 1;
				break;
			case(FontStyle.Underline):
				lf.lfUnderline = 1;
				break;
		}

		// Don't know why but the next flag makes Windows text look ugly
		// lf.lfQuality = Win32.Api.FontQuality.CLEARTYPE_QUALITY;

		hFont = Win32.Api.CreateFontIndirectA(ref lf);
	}