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. Aligning text in CRichEditCtrl

Aligning text in CRichEditCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 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.
  • S Offline
    S Offline
    Sprudling
    wrote on last edited by
    #1

    I want the text in a CRichEditCtrl to appear as in a console, with the "latest" line at the bottom and all text bottomaligned, so that if there is just one line it'll be alone at the bottom. Is there a way of implementing this...? Sprudling :confused:

    N 1 Reply Last reply
    0
    • S Sprudling

      I want the text in a CRichEditCtrl to appear as in a console, with the "latest" line at the bottom and all text bottomaligned, so that if there is just one line it'll be alone at the bottom. Is there a way of implementing this...? Sprudling :confused:

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      You can use CRichEditCtrl::SetRect(). Apply the number of lines, the font height and some math. :)

      L S 2 Replies Last reply
      0
      • N Niklas L

        You can use CRichEditCtrl::SetRect(). Apply the number of lines, the font height and some math. :)

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Or might want to try CRichEditCtrl::SetParaFormat

        S 1 Reply Last reply
        0
        • L Lost User

          Or might want to try CRichEditCtrl::SetParaFormat

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

          How could CRichEditCtrl::SetParaFormat help me? Sprudling

          1 Reply Last reply
          0
          • N Niklas L

            You can use CRichEditCtrl::SetRect(). Apply the number of lines, the font height and some math. :)

            S Offline
            S Offline
            Sprudling
            wrote on last edited by
            #5

            Thanks; how to calculate a font's height? :) And what if I've turned on wrapping (no horizontal scoll). Will that count as a new line or not? (When returned from CRichEditCtrl::GetLineCount()) Sprudling

            N 1 Reply Last reply
            0
            • S Sprudling

              Thanks; how to calculate a font's height? :) And what if I've turned on wrapping (no horizontal scoll). Will that count as a new line or not? (When returned from CRichEditCtrl::GetLineCount()) Sprudling

              N Offline
              N Offline
              Niklas L
              wrote on last edited by
              #6

              The height can be calculated using CDC::GetTextExtent(). As for the wrapping, I have no clue :) You will have to try it.

              N 1 Reply Last reply
              0
              • N Niklas L

                The height can be calculated using CDC::GetTextExtent(). As for the wrapping, I have no clue :) You will have to try it.

                N Offline
                N Offline
                Niklas L
                wrote on last edited by
                #7

                Niklas Lindquist wrote: The height can be calculated using CDC::GetTextExtent(). or rather use the lfHeight member of the LOGFONT structure. Can be retreived from CFont::GetLogFont() I think.

                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