![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I have been trying to find a way to make a TextBox or RichTextBox with word-wrap enabled "grow/shrink automatically" in height as the user types new lines (or deletes existing ones). And scrollbars are out for this usage. Monitoring the 'TextChanged Event and using the 'Lines property of the TextBox or RichTextBox gives you an easy way to count the number of lines ... if the user has done a carriage return. Once you have the number of lines, it's trivial to adjust the height based on some heuristic (we're not dealing with complexly formatted text in the case of the RichTextBox). Unfortunately a word-wrap event itself doesn't raise any top-level Event I can find, and of course it doesn't affect the number of lines. I assume you could do some GDI stuff with a PictureBox and the 'measureString function, but I'd like to avoid messing around with the Paint event if at all possible. I'm also assuming there's probably a way to intercept word-wrap with a WndProc, but found no example on P/Invoke. Also checked CodeProject : no dice there on this type of usage. Appreciate any suggestions. thanks, Bill |
#3
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |