PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Dynamic Word Wrap in RichTextControl
Working with the Rich Text Control on a recent project I found a problem with dynamically altering the word wrap property. I needed to work internally with the text in the control on a line by line basis but wanted to show the user the results with word wrapping on.

The problem I found was that when I changed the property to FALSE it worked fine but when I changed it back to TRUE it had no effect.

The work around I found was to resize the Control after switching it to TRUE and the resize it back to the original size before finally switching redraw back on, see the example below:

rte_old.SetRedraw( FALSE )
rte_old.wordwrap = FALSE
li_H=rte_Old.Height
li_W=rte_Old.Width

// do my work on lines here

rte_old.wordwrap = TRUE
rte_Old.Resize( 1, 1 )
rte_Old.Resize( li_W, li_H )
rte_old.SetRedraw( TRUE )
 

Top of Page

Legal Notice

Ken Howe 2011