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. Justify text in a CStatic control

Justify text in a CStatic control

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 Posts 3 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
    doctorpi
    wrote on last edited by
    #1

    Hi guys ¿Do you know a way to show a long text (CString) in a CStatic justified or left aligned? Thanks in forwarding. Dr.Pî

    D 1 Reply Last reply
    0
    • D doctorpi

      Hi guys ¿Do you know a way to show a long text (CString) in a CStatic justified or left aligned? Thanks in forwarding. Dr.Pî

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Text is left justified by default. :confused: Perhaps I'm misunderstanding.

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      D 1 Reply Last reply
      0
      • D David Crow

        Text is left justified by default. :confused: Perhaps I'm misunderstanding.

        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        D Offline
        D Offline
        doctorpi
        wrote on last edited by
        #3

        Sorry, I was talking about a CMyStatic where your own paints the text,bitmaps,etc... Dr.Pi

        C D 2 Replies Last reply
        0
        • D doctorpi

          Sorry, I was talking about a CMyStatic where your own paints the text,bitmaps,etc... Dr.Pi

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          the famous CMyStatic, how did I forget about? :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          [my articles]

          1 Reply Last reply
          0
          • D doctorpi

            Sorry, I was talking about a CMyStatic where your own paints the text,bitmaps,etc... Dr.Pi

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Are you using TextOut()?

            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            C D 2 Replies Last reply
            0
            • D David Crow

              Are you using TextOut()?

              "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              I suppose. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              [my articles]

              1 Reply Last reply
              0
              • D David Crow

                Are you using TextOut()?

                "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                D Offline
                D Offline
                doctorpi
                wrote on last edited by
                #7

                Yes.

                D 1 Reply Last reply
                0
                • D doctorpi

                  Yes.

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  And what is the value of the second argument?

                  "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  D 1 Reply Last reply
                  0
                  • D David Crow

                    And what is the value of the second argument?

                    "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    D Offline
                    D Offline
                    doctorpi
                    wrote on last edited by
                    #9

                    The problem is that I have a CString too long for the width of the control (then I have to show as multiline). Then, I don't know how to manage this.

                    D 1 Reply Last reply
                    0
                    • D doctorpi

                      The problem is that I have a CString too long for the width of the control (then I have to show as multiline). Then, I don't know how to manage this.

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      If this is a CStatic control, why aren't you using SetWindowText(), rather than rendering the text yourself with TextOut()?

                      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      D 1 Reply Last reply
                      0
                      • D David Crow

                        If this is a CStatic control, why aren't you using SetWindowText(), rather than rendering the text yourself with TextOut()?

                        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                        D Offline
                        D Offline
                        doctorpi
                        wrote on last edited by
                        #11

                        Cause in addition to the text I have graphics in the same CStatic derived class. SetWindowText() don't have any control about in which position inside the control you write your text. Imagine a INFO panel where there is a border, some graphics and a multiline text. Anyway don't worry, I've found a simple way. Dr.Pi

                        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