• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Bizarre font size problem in VB.net

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Bizarre font size problem in VB.net

    Have a program that was all tested out and I have not changed the code, just the images displayed. It still works ok with the previous set of images. Marking some images with an "X" in one corner but it is drawing at a huge fontsize although the debugger tells me the fontsize is as expected. With a test copy to clipboard added just to make sure I am not doing something daft later on, the relevant code is:

    Private scratch As New PictureBox
    Private gr1 As Graphics
    ...
    gr1 = Graphics.FromImage(scratch.Image)
    gr1.DrawString("X", MainBox1.Font, Brushes.Red, pr.PicTX, pr.PicTY)
    My.Computer.Clipboard.Clear()
    My.Computer.Clipboard.SetImage(scratch.Image)

    Debug tells me that MainBox1.Font = {Name = "Arial" Size=12.0} but when I open the clipboard my "X" is more like fontsize 180!!! Drawline etc also comes out similarly enlarged. The sizemode of scratch is normal.

    I can't think of any reason and can't find owt useful on net so grateful for any suggestions on this.
    Last edited by xoggoth; 6 March 2008, 13:57.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    #2
    Have asked a few questions on net and it has been suggested the internal resolution of pictures is too high. PSP reports images that work as 508 pixels/inch, ie 832x690 pixels, 1.638x1.358 inches and ones that don't as 71 pixels/inch, ie 832x690 pixels, 11.702x9.705 inches.

    I really have no idea what that means as they look the same.
    bloggoth

    If everything isn't black and white, I say, 'Why the hell not?'
    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

    Comment


      #3
      The issue of dpi can certainly be a factor, if I'm correct in that the new ones have a higher perceived resolution.

      Font sizes, as you might have discovered by now, are usually (though not always) specified in points/parts of an inch. If the image is considered to be 508 dpi then of course the font is scaled as appropriate.

      Had a similar problem not too long ago with some jpegs where the EXIF data was corrupted somewhere along the way and the dpi ended up at 24000 horizontal, 600 vertical, resulting in them being displayed as one pixel lines when viewed as thumbnails.

      If that's the case then you simply need to open and resave the images with the correct/adjusted dpi in Photoshop/Paintshop Pro, or if they're jpegs already and you don't want to lose quality then do a Google for an EXIF tool. Usually 96dpi is the case for MS, 72 for Macs.

      Comment


        #4
        Ta Joe, have solved it by pasting into Paint and resaving. They still look exactly the same.
        bloggoth

        If everything isn't black and white, I say, 'Why the hell not?'
        John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

        Comment

        Working...
        X