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#
  4. Justify text

Justify text

Scheduled Pinned Locked Moved C#
graphicshelptutorial
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.
  • D Offline
    D Offline
    Duong Tien Nam
    wrote on last edited by
    #1

    System.Drawing.StringFormat class allows you to justify a text to left, right, top, bottom, center and middle of the clip rect. But I saw in Microsoft Word an option to justify text to both margin, so every line of text has the same width. I checked the System.Drawing.StringFormat properties and didn't find out how to do this. Please help me, thanks alot.

    J D 2 Replies Last reply
    0
    • D Duong Tien Nam

      System.Drawing.StringFormat class allows you to justify a text to left, right, top, bottom, center and middle of the clip rect. But I saw in Microsoft Word an option to justify text to both margin, so every line of text has the same width. I checked the System.Drawing.StringFormat properties and didn't find out how to do this. Please help me, thanks alot.

      J Offline
      J Offline
      joon vh
      wrote on last edited by
      #2

      I've done a quick lookup, and you're right, it doesn't work, not for textbox, not for richtextbox. I read on a forum that it was just not possible at all, without using custom controls that you can buy/make. Although I would hope that Framework 3.0 or GDI+ has this functionality somewhere. I can't help you with that, but you could point your question towards them (also).


      public object BufferOverFlow { __get { return BufferOverFlow; } __set { BufferOverFlow = value; } }

      1 Reply Last reply
      0
      • D Duong Tien Nam

        System.Drawing.StringFormat class allows you to justify a text to left, right, top, bottom, center and middle of the clip rect. But I saw in Microsoft Word an option to justify text to both margin, so every line of text has the same width. I checked the System.Drawing.StringFormat properties and didn't find out how to do this. Please help me, thanks alot.

        D Offline
        D Offline
        Duong Tien Nam
        wrote on last edited by
        #3

        I got the problem when using Graphics object to draw text, like this Graphics g; g.DrawString("Text", font, brush, rect, format); with format is an instance of System.Drawing.StringFormat No way to strect the text lines to have the same width :(( Thanks for your answer anyway.

        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