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. Top margin in CEditView

Top margin in CEditView

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 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.
  • H Offline
    H Offline
    Hugh S Myers
    wrote on last edited by
    #1

    It's clear how to set right and left margins in an instance of CEditView. Is there a way to effectively set a top margin? --hsm

    R H 2 Replies Last reply
    0
    • H Hugh S Myers

      It's clear how to set right and left margins in an instance of CEditView. Is there a way to effectively set a top margin? --hsm

      R Offline
      R Offline
      Richard_48
      wrote on last edited by
      #2

      In the PARAFORMAT2 Structure there is a member called dySpaceBefore. You will need to build a function to call this member using the dwMask member. The value must always be > than or = 0. The Size of the spacing is in twips. You may be able to set up something similar in the PARAFORMAT structure if you are using later versions of Visual C++. Go to MDN.COM and do a search for PARAFORMAT OR PARAFORMAT2. I think there is an example there somewhere..?? regards, RRL

      R H 2 Replies Last reply
      0
      • R Richard_48

        In the PARAFORMAT2 Structure there is a member called dySpaceBefore. You will need to build a function to call this member using the dwMask member. The value must always be > than or = 0. The Size of the spacing is in twips. You may be able to set up something similar in the PARAFORMAT structure if you are using later versions of Visual C++. Go to MDN.COM and do a search for PARAFORMAT OR PARAFORMAT2. I think there is an example there somewhere..?? regards, RRL

        R Offline
        R Offline
        Richard_48
        wrote on last edited by
        #3

        sorry. I ment msdn.com not mdn.com also, if you ar running v.s. 6.0 PARAFORMAT may be the structure to use... RRL

        H 1 Reply Last reply
        0
        • R Richard_48

          sorry. I ment msdn.com not mdn.com also, if you ar running v.s. 6.0 PARAFORMAT may be the structure to use... RRL

          H Offline
          H Offline
          Hugh S Myers
          wrote on last edited by
          #4

          Much thanks, I'll take a look. --hsm

          1 Reply Last reply
          0
          • R Richard_48

            In the PARAFORMAT2 Structure there is a member called dySpaceBefore. You will need to build a function to call this member using the dwMask member. The value must always be > than or = 0. The Size of the spacing is in twips. You may be able to set up something similar in the PARAFORMAT structure if you are using later versions of Visual C++. Go to MDN.COM and do a search for PARAFORMAT OR PARAFORMAT2. I think there is an example there somewhere..?? regards, RRL

            H Offline
            H Offline
            Hugh S Myers
            wrote on last edited by
            #5

            I just looked. Two problems occur to me; first, this is for a CRichEditView, not a CEditView. The other problem is that this would allow control of the space above a paragraph--- not the space above the page. Perhaps I'm missing something? --hsm

            1 Reply Last reply
            0
            • H Hugh S Myers

              It's clear how to set right and left margins in an instance of CEditView. Is there a way to effectively set a top margin? --hsm

              H Offline
              H Offline
              Hugh S Myers
              wrote on last edited by
              #6

              For those with the same problem, a tentative answer is to set the rectangle in the CEdit control: void CPGNTextView::SetTopMargin() { CEdit &theEdit = GetEditCtrl(); CRect r; theEdit.GetRect(&r); TRACE("t=%d l=%d b=%d r=%d\n",r.top,r.left,r.bottom,r.right); r.top = TOP_MARGIN; theEdit.SetRect(&r); TRACE("t=%d l=%d b=%d r=%d\n",r.top,r.left,r.bottom,r.right); } And then to do it again in WM_SIZE and WM_SETFONT handlers. Seems like overkill, but the CEdit control loses this information every chance it gets so you just have to help it along so to speak. --hsm

              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