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. Character "space" in a textbox -- same space used for upper and lower case?

Character "space" in a textbox -- same space used for upper and lower case?

Scheduled Pinned Locked Moved C#
csharptutorialquestion
6 Posts 4 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.
  • S Offline
    S Offline
    shultas
    wrote on last edited by
    #1

    Hey All, I've been playing with the textbox in C#. I cannot seem to get it so that uppercase characters and lowercase characters take up the same amount of space in the box. For example like in the textbox here on CP to enter messages: this line aligns perfectly with THIS LINE ALIGNS PERFECTLY They both align perfectly regardless of case. In my textbox, if I use uppercase on one line and lowercase on the next line, the uppercase line takes up a lot more space and they do not line up. TIA!

    S 1 Reply Last reply
    0
    • S shultas

      Hey All, I've been playing with the textbox in C#. I cannot seem to get it so that uppercase characters and lowercase characters take up the same amount of space in the box. For example like in the textbox here on CP to enter messages: this line aligns perfectly with THIS LINE ALIGNS PERFECTLY They both align perfectly regardless of case. In my textbox, if I use uppercase on one line and lowercase on the next line, the uppercase line takes up a lot more space and they do not line up. TIA!

      S Offline
      S Offline
      shultas
      wrote on last edited by
      #2

      ...the two lines lign up perfect in the textbox here to enter in the message, but when it is displayed it is displaying exactly like I am talking about in my application.

      M 1 Reply Last reply
      0
      • S shultas

        ...the two lines lign up perfect in the textbox here to enter in the message, but when it is displayed it is displaying exactly like I am talking about in my application.

        M Offline
        M Offline
        Muntyness
        wrote on last edited by
        #3

        Have you tried using a font like Lucida Console? (Fixed width font - every character uses the same width)

        S 1 Reply Last reply
        0
        • M Muntyness

          Have you tried using a font like Lucida Console? (Fixed width font - every character uses the same width)

          S Offline
          S Offline
          shultas
          wrote on last edited by
          #4

          Incredibly cool, that worked!!!! Thanks! Do you know how to tell (other than trying them one by one) which fonts are fixed width? Again, thanks a lot!

          P E 2 Replies Last reply
          0
          • S shultas

            Incredibly cool, that worked!!!! Thanks! Do you know how to tell (other than trying them one by one) which fonts are fixed width? Again, thanks a lot!

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            You can retrieve a fixed width font family using System.Drawing.FontFamily family = System.Drawing.FontFamily.GenericMonospace.

            Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world." Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that." Deja View - the feeling that you've seen this post before.

            1 Reply Last reply
            0
            • S shultas

              Incredibly cool, that worked!!!! Thanks! Do you know how to tell (other than trying them one by one) which fonts are fixed width? Again, thanks a lot!

              E Offline
              E Offline
              Eric Dahlvang
              wrote on last edited by
              #6

              http://en.wikipedia.org/wiki/List_of_typefaces#Monospaced[^] http://en.wikipedia.org/wiki/Samples_of_Monospaced_typefaces[^]

              --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

              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