473,499 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2799
Does anyone have any thoughts on this or is the wrong group for this
question?

Feb 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1487
by: Karthik Seetharaman | last post by:
Given a string, the font, fontstyle and fontsize how do i calculate the rectangle that will hold it ? thanks.
3
1362
by: Mike Kitchen | last post by:
I am writing an application in visual basic from a C# that I have already written. I am trying to convert the following line of code into VB, but I do not completely understand the help pages....
3
4219
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
1
16211
by: Prasad More | last post by:
Hello, I am trying to write a text on Multi-page TIFF image using C# and .NET GDI+. I have written following code to do this. When I execute this code I get "Invalid Parameter User. at...
2
22278
by: Alphonse Giambrone | last post by:
I am currently reading 'Programming The Web with Visual Basic .NET' and have so far found it to be excellent. Downloaded all the code from Apress and working in chapter 4, I get the error shown...
5
5021
by: jack | last post by:
In using GDI+ drawstring, if the string to be drawn is in rtf format, how do I make GDI+ to recognize the rtf attributes. In other words, how do I draw one string in GDI+ , within which the...
0
4730
by: Brian Keating | last post by:
hi there i've a test program that creates a treeview and destroys it over and over, i keep track of the gdi object count for the process and see if they are ok. However when i switch on...
1
5035
by: Pranil Kanderi | last post by:
I have a huge application with lots of custom controls. The app had a memory leak but fixed that by calling the dispose method where needed and now the user objects are very stable, when I am...
0
1272
by: boeledi | last post by:
I'm new in GDI programming and I am facing the following problem. I try to dynamically create "thumbnail"-like images (JPEG) in which I need to draw text. This works fine, except that the text is...
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.