Results 1 to 7 of 7

Thread: The character "1" appears to be handled differently with the Print statement

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,240

    The character "1" appears to be handled differently with the Print statement

    Unlike any other character, including all the other decimal digit characters, is handled weirdly by the Print statement, in what appears to be a bug. If you have the code:
    Code:
    Print "1"; "1"; "1"; "1"
    Print "1111"
    Those two lines of code SHOULD produce identical outputs. However (at least with VB6's default Font for Form1, which is Arial) the result is that the Print statement with 4 concatenated "1" characters is used the digits are displayed as separated slightly more from each other, compared to when the single string "1111" is displayed via the Print statement. I've tried the other numbers, and even skinny letters like "l", but none of those produce this same discrepancy. So I'm guessing this is a bug.

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,637

    Re: The character "1" appears to be handled differently with the Print statement

    Can't reproduce. Form font is using the default of MS Sans Serif. Using VB 6.0 SP5 on a VM running Windows 2000 Server w/ SP4.

    The code produces "pixelly identical" output, verified in MSPaint at a ridiculous zoom level.

  3. #3
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,710

    Re: The character "1" appears to be handled differently with the Print statement

    I could reproduce it. Only with Arial normal. It didn't happen with:
    Segoe UI
    Arial Narrow
    MS Sans Serif
    Microsoft Sans Serif
    Tahoma
    Verdana

    The VB6 default font for forms is MS Sans Serif, not Arial. Arial is the default font for the Printer object.

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,637

    Re: The character "1" appears to be handled differently with the Print statement

    Quote Originally Posted by Eduardo- View Post
    I could reproduce it. Only with Arial normal. It didn't happen with:
    Segoe UI
    Arial Narrow
    MS Sans Serif
    Microsoft Sans Serif
    Tahoma
    Verdana

    The VB6 default font for forms is MS Sans Serif, not Arial. Arial is the default font for the Printer object.
    Whoops, I didn't even catch the mention of Arial in the first post. I changed the font to Arial and was unable to reproduce it. But I'm using an old OS in a very standard "classic" video resolution. I would guess this is somehow related to modern high resolution monitors and DPI scaling.

  5. #5
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,710

    Re: The character "1" appears to be handled differently with the Print statement

    Code:
    Private Sub Form_Load()
        Me.Font.Name = "Arial"
        Me.Font.Size = 16
        Me.AutoRedraw = True
        Print "1"; "1"; "1"; "1"
        Print "1111"
        Print
        Print "TwipsPerPixel: " & Screen.TwipsPerPixelX
    End Sub
    96 DPI (100%):

    Name:  96 DPI (100%).png
Views: 23
Size:  3.5 KB

    120 DPI (125%)

    Name:  120 DPI (125%).png
Views: 23
Size:  5.5 KB

    Windows 11 22H2

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,240

    Re: The character "1" appears to be handled differently with the Print statement

    Quote Originally Posted by OptionBase1 View Post
    Whoops, I didn't even catch the mention of Arial in the first post. I changed the font to Arial and was unable to reproduce it. But I'm using an old OS in a very standard "classic" video resolution. I would guess this is somehow related to modern high resolution monitors and DPI scaling.
    I'm using Windows 10 (yes VB6 works even on that), and MS Sans Serif isn't even an available font (maybe is obsolete/discontinued on modern versions of Windows), so VB6 must have picked the next best option, Arial. I'm not sure what Windows version you were using to test this.


    I don't have a DPI setting (such as 96 DPI) in Windows 10. Instead I have a scale factor (such as 100%). I'm using the default of 100% for the scale factor.
    Last edited by Ben321; Today at 03:23 PM.

  7. #7
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,710

    Re: The character "1" appears to be handled differently with the Print statement

    Quote Originally Posted by Ben321 View Post
    I'm using Windows 10 and MS Sans Serif isn't even an available font
    Yes, it is. It is on every Windows version.
    Maybe there is a problem with your Windows 10 installation.

    Name:  W10MSSS.jpg
Views: 5
Size:  30.2 KB

    Quote Originally Posted by Ben321 View Post
    I don't have a DPI setting (such as 96 DPI) in Windows 10. Instead I have a scale factor (such as 100%). I'm using the default of 100% for the scale factor.
    That is, 100% is 96 DPI.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width