Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. GDI+ drawing strings causes messed gaps between letters - how to fix?

GDI+ drawing strings causes messed gaps between letters - how to fix?

Scheduled Pinned Locked Moved C#
graphicswinformslinuxhelptutorial
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iliyang
    wrote on last edited by
    #1

    I just cant' get how to draw strings with "proper" letter spacing, especially when they're bold. Some letters in specific combinations when being drawn next to each other appear slured (without even a pixel gap). The font I'm using is the default MS Sans Serif 8,25pt Here's a link to a sample screenshot: >> link The left one is drawn using the Graphics.DrawString method and the right one is a screenshot from a ListView. Why is that difference? How to achieve this?

    M 1 Reply Last reply
    0
    • I iliyang

      I just cant' get how to draw strings with "proper" letter spacing, especially when they're bold. Some letters in specific combinations when being drawn next to each other appear slured (without even a pixel gap). The font I'm using is the default MS Sans Serif 8,25pt Here's a link to a sample screenshot: >> link The left one is drawn using the Graphics.DrawString method and the right one is a screenshot from a ListView. Why is that difference? How to achieve this?

      M Offline
      M Offline
      MoustafaS
      wrote on last edited by
      #2

      iliyang wrote: How to achieve this? May be you must change the StringFormat class ?

      I 1 Reply Last reply
      0
      • M MoustafaS

        iliyang wrote: How to achieve this? May be you must change the StringFormat class ?

        I Offline
        I Offline
        iliyang
        wrote on last edited by
        #3

        Well, turns out that it is a global issue and there's no way (at least that I know) that can fix this. Thе string that I drew was something like "bla bla the_messed_part" (1) and the string in the listview was "the_messed_part" (2). And when I tried to draw the string (2) or let the listview draw the string (1) both work the same way. So I guess the solution is to choose a different font like Tahoma, for example, which looks like MS Sans Serif. Of course, this is not a very good solution, 'cause this way I'm fixing the font and if the user has a totally different system font set, it'll be pretty ugly...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups