Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everyone.


i have a problem,i can not find the Solutions.
C++
PARAFORMAT2 pf2;
ZeroMemory(&pf2, sizeof(PARAFORMAT2));
pf2.dwMask = PFM_LINESPACING;
pf2.bLineSpacingRule = 4;
pf2.dyLineSpacing = 300;
SetSel(iBPos,iEPos);
    SetParaFormat(pf2);

when i expand the line spacing by the code.
but the text is not centered vertically,and the text is close to the next line,the linespace Appears above.

i want to make the text be centered vertically in the line, what can i do?

i do not sure it can be achieved in the richedit,but i see that the text be centered vertically in a line,when i expand the line spacing in the officeword.
Posted
Updated 25-Nov-12 22:31pm
v2
Comments
chaau 26-Nov-12 17:04pm    
do you set pf2.cbSize = sizeof(PARAFORMAT2) somewhere in your code after ZeroMemory call? Have you tried using dySpaceBefore and dySpaceAfter instead?
lin98666521 26-Nov-12 20:35pm    
oh,i do not set pf2.cbSize = sizeof(PARAFORMAT2),but i have tried using dyspacebefore,it do not work.
lin98666521 26-Nov-12 20:49pm    
hi,thank you very much,it is my oversight, i set pf2.cbSize = sizeof(PARAFORMAT2),it work well.

you shall submit your solution,i will take it.

1 solution

Set
pf2.cbSize = sizeof(PARAFORMAT2)
after you ZeroMemory the pf2 and it should all work
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900