Top margin in CEditView
-
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
-
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
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
-
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
-
Much thanks, I'll take a look. --hsm
-
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
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
-
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
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