richtextbox - How to add a space after the paragraph RTF c#? -


hi problem have richtextbox wanna add "pretty" space after paragraph, found on internet many examples examples change lines , not paragraph.

private void formatrtb(byte rule, int space, int x)     {         paraformat fmt = new paraformat();         fmt.cbsize = marshal.sizeof(fmt);         fmt.dwmask = pfm_linespacing;         fmt.dylinespacing = space;         fmt.blinespacingrule = rule;         richtextbox1.select(x, 2);         sendmessage(new handleref(richtextbox1, richtextbox1.handle),                      em_setparaformat,                      scf_selection,                      ref fmt                    );     } 

well add code , select ony \n because after of "\n" start paragraph , dosent works dont if logic bad or need add more code

while (richtextbox1.text.indexof("\n", k) > 0)         {             k = richtextbox1.text.indexof("\n", k);             setlineformat(2, 0, k);             k++;         } 

.

i know there accepted answer, maybe other people.

if want add spacing before or after paragraph in richtextbox, there simple , "native" (ie. no hacking) solution using pfm_spacebefore or pfm_spaceafter. code quite similar first 1 present.

the complete solution custom control posted on http://dominicweb.eu/en/blog/various/winforms-richtextbox-with-paragraph-spacing-csharp/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -