Windows Develop Bookmark and Share   
 index > Windows Forms General > Justifying Text
 

Justifying Text

I want to justify a text in a richtextbox control (like word)
I try this api SetTextJustification in combination whith GetTextExtendPoint32 and ExtextOut. But I can't get the expected result.
Dig Bands

steweev  Friday, September 25, 2009 9:53 AM
You can't make that work, RTB doesn't support any kind of user-implemented painting like ListBox.DrawMode. The later versions of the native Windows RichEdit control support justified text, not the one that .NET uses though. You'll need a lot of surgery to make that happen, it starts by creating a .NET control that uses msftedit.dll. Then you need EM_SETPARAFORMAT to select PARAFORMAT2.wAlignment = PFA_JUSTIFY. Good luck.

Hans Passant.
nobugz  Friday, September 25, 2009 10:55 AM
Following link contain code to justify in RichTextBox

http://geekswithblogs.net/pvidler/archive/2003/10/14/182.aspx
Gaurav Khanna
Khanna Gaurav  Friday, September 25, 2009 11:39 AM
You can't make that work, RTB doesn't support any kind of user-implemented painting like ListBox.DrawMode. The later versions of the native Windows RichEdit control support justified text, not the one that .NET uses though. You'll need a lot of surgery to make that happen, it starts by creating a .NET control that uses msftedit.dll. Then you need EM_SETPARAFORMAT to select PARAFORMAT2.wAlignment = PFA_JUSTIFY. Good luck.

Hans Passant.
nobugz  Friday, September 25, 2009 10:55 AM
Following link contain code to justify in RichTextBox

http://geekswithblogs.net/pvidler/archive/2003/10/14/182.aspx
Gaurav Khanna
Khanna Gaurav  Friday, September 25, 2009 11:39 AM

You can use google to search for other answers

Custom Search

More Threads

• Handling overlapping mnemonics on a form
• Overloading a Form's constructor in VS2005
• DataGridView Column Reordering via Drag n Drop
• RichTextBox SelectionFont
• Row and Column Selection in DataGridView
• Inserting char into empty rich text box
• Issues around using GetAsyncKeyState(int vKey ) function
• How to capture a "back Tab" (Shift+Tab) key?
• Does anyone have a working example of menustrip styles?
• Cursor related with color