471,605 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

GDI+ and GDI font size inconsistances

I have the following code

public static IntPtr CreateFont ( Font fnt )
{
LOGFONT logFont = new LOGFONT();
logFont.lfFaceName = fnt.Name;
logFont.lfHeight = -Win32API.MulDiv((int)fnt.Size,
Win32API.GetDeviceCaps(Win32API.GetDC(0), LOGPIXELSY), 72);
logFont.lfItalic = (byte) ((fnt.Italic) ? (0x01):(0x00));
logFont.lfStrikeOut = (byte) ((fnt.Strikeout) ? (0x01):(0x00));
logFont.lfUnderline = (byte) ((fnt.Underline) ? (0x01):(0x00));
if ( fnt.Bold )
logFont.lfWeight = 800;
else
logFont.lfWeight = 400;
return Win32API.CreateFontIndirect ( logFont );
}

This attempts to create a HFONT from a Font. I tried ToHFont as well.
It works on some displays but on other displays the font looks
completly distored when it is created this way. What I am doing wrong?
I need to do this so I can underline leading and trailing spaces.

Feb 6 '06 #1
1 2703
Does anyone have any thoughts on this or is the wrong group for this
question?

Feb 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Karthik Seetharaman | last post: by
3 posts views Thread by Mike Kitchen | last post: by
1 post views Thread by Prasad More | last post: by
2 posts views Thread by Alphonse Giambrone | last post: by
5 posts views Thread by jack | last post: by
reply views Thread by Brian Keating | last post: by
1 post views Thread by Pranil Kanderi | last post: by
reply views Thread by boeledi | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.