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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. [GDI] x-offset when using Graphics::DrawString(...) [modified]

[GDI] x-offset when using Graphics::DrawString(...) [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelpquestion
3 Posts 2 Posters 0 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.
  • _ Offline
    _ Offline
    _NielsB
    wrote on last edited by
    #1

    Hello! I am using the following Function to draw text to a screen:

    Status DrawString( const WCHAR *string,
    INT length,
    const Font *font,
    const PointF &origin,
    const StringFormat *stringFormat,
    const Brush *brush
    );

    Works fine, but there is one major problem : even if I use PointF(0,0) as origin, the text is displayed with an x-offset (the concrete width in pixel seems to depend on the Font-Object I use within the DrawString - Function). Any Solution about that? Is this a known bug or even a feature? ;) Thanks in advance! -- modified at 6:43 Wednesday 24th January, 2007

    M 1 Reply Last reply
    0
    • _ _NielsB

      Hello! I am using the following Function to draw text to a screen:

      Status DrawString( const WCHAR *string,
      INT length,
      const Font *font,
      const PointF &origin,
      const StringFormat *stringFormat,
      const Brush *brush
      );

      Works fine, but there is one major problem : even if I use PointF(0,0) as origin, the text is displayed with an x-offset (the concrete width in pixel seems to depend on the Font-Object I use within the DrawString - Function). Any Solution about that? Is this a known bug or even a feature? ;) Thanks in advance! -- modified at 6:43 Wednesday 24th January, 2007

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      _NielsB wrote:

      the text is displayed with an x-offset

      How much of an x offset?

      _ 1 Reply Last reply
      0
      • M Mark Salsbery

        _NielsB wrote:

        the text is displayed with an x-offset

        How much of an x offset?

        _ Offline
        _ Offline
        _NielsB
        wrote on last edited by
        #3

        As I wrote, it seems to depends on the Font that is in use within the function call.

        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