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. Newline in Label Text

Newline in Label Text

Scheduled Pinned Locked Moved C#
question
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.
  • O Offline
    O Offline
    Okeno Palmer
    wrote on last edited by
    #1

    Greets all, How do you get a newline in Text property of a Label control? I've tried \n and \r\n but neither work. Any suggestions? .:. Keno .:.

    H 1 Reply Last reply
    0
    • O Okeno Palmer

      Greets all, How do you get a newline in Text property of a Label control? I've tried \n and \r\n but neither work. Any suggestions? .:. Keno .:.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      You would have to owner-draw (i.e., override OnPaint) to accomplish such a thing. A common work-around is to use a multi-line TextBox with ReadOnly set to true and no border. Then you can use Environment.NewLine (portable code should never hard-code carriage returns and/or line feeds).

      Microsoft MVP, Visual C# My Articles

      O 1 Reply Last reply
      0
      • H Heath Stewart

        You would have to owner-draw (i.e., override OnPaint) to accomplish such a thing. A common work-around is to use a multi-line TextBox with ReadOnly set to true and no border. Then you can use Environment.NewLine (portable code should never hard-code carriage returns and/or line feeds).

        Microsoft MVP, Visual C# My Articles

        O Offline
        O Offline
        Okeno Palmer
        wrote on last edited by
        #3

        Thanks Heath! I wonder why this functionality isn't available though, If I remeber correctly this was possible in VC wasn't it? .:. Keno .:.

        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