Differences in font size between VB6 and VB.NET

When setting the font size of point 10 in VB6:

Me.FontName = "Verdana" Me.FontSize = 10 Debug.Print Me.FontSize 

The font size is 9.75. However, when the same thing is done in VB.NET:

 Me.Font = New System.Drawing.Font("Verdana", 10) Console.WriteLine(Me.Font.Size) 

The reported size is 10. Can someone explain the difference here? My guess is that VB6 uses the .75 step because my system is set to 96 DPI and .NET does not use the specified step or report its use, but I'm not sure.

+4
source share
2 answers

There is nothing wrong, and both are technically the same on the display. It just tells the font "more accurately." The font pitch for 96 dpi is 0.75 (0.6 at 120 DPI), so the steps are technically from 9 to 9.75 to 10.5.

+1
source

The property pitch of Size 72 / GetDeviceCaps(hDC, LOGPIXELSY) , which in small-sized fonts (96 DPI) is 0.75, and in large fonts (120 DPI) - 0.6

You can use SetRatio in OleFont to control the denominator in the previous expression. GetDeviceCaps - The default value.

0
source

Source: https://habr.com/ru/post/1300879/


All Articles