Text width is not displayed correctly in mm vb6

I have a window with pictures and I am typing the content into it. I want to know the exact text width of the text in millimeters. But I am wrong. here is my code

me.scalemode = vbmillimeters
picturebox.scalemode = vbmillimeters

picturebox.fontname = "Arial"
picturebox.fontsize = 12
debug.print textwidth("AB.C.D.E. FGHIJKLMN")

      

When I measure in the printout on paper it is 48mm but it shows 32.97mm

Please help me where is wrong. thanks in advance

+3


source to share


1 answer


If you want the width of the text printed in the image window, use:

PictureBox.textwidth("AB.C.D.E. FGHIJKLMN")

What you are actually doing: textwidth("AB.C.D.E. FGHIJKLMN")

Move the same text printed in the form ( Me

).

Doing this would be less error prone:



Dim TextWidth as Single
With PictureBox
  .ScaleMode = vbMillimeters
  .FontName = "Arial"
  .FontSize = 12
  TextWidth = .TextWidth("AB.C.D.E. FGHIJKLMN")
End With

      

because if you go to paper you can also switch context easily:

With SelectedPrinter....

      

+4


source







All Articles