I’m currently generating a report for printing with a control derived from the RichTextBox control. I’ve got a couple paragraphs that are indented with the .SelectionIndent and .SelectionRightIndent properties, but I also wish to make them full justified (with subtle sub-character spacing, as how Microsoft Word does it).
The .SelectionAlignment property is available, but only offers Left, Center, and Right alignment.
Is there a way to specify Full Justification in a RichTextBox? I’m willing to dig into the underlying RTF protocol if necessary (should the protocol itself support this feature), but I’m not willing to create a bitmap of the text formatted to full justification to be embedded in the document.
For what it’s worth, I’m using RICHEDIT50W from msftedit.dll, and can’t rely on the clients having any version of Word installed.
You can extend the RichTextBox control like this & set the PARAFORMAT2 structure’s Paragraph alignment member
wAlignmenttoPFA_JUSTIFY. To use this member,set the PFM_ALIGNMENT flag in the dwMask member.NB: RichEdit 2.0 Paragraphs are justified. Rich edit controls earlier than RichEdit 3.0 display the text aligned with the left margin.
[You have to write the corresponding P/Invokes of the WIN32 apis as depicted in the sample link]