Resize richtextbox to fit content 
Author Message
 Resize richtextbox to fit content

I am trying to create a control, that is inherited from
the RichTextBox control, that will detect when either the
text in the box has changed or the width of the control
has changed and will resize the height of the control to
fit the text.  I am having trouble figuring out what the
exact height of the text is in the RichTextBox.  Does
anyone have an idea about how to do this?


Sat, 05 Mar 2005 23:24:03 GMT  
 Resize richtextbox to fit content
Just in case anyone is interested....It turns out it is
actually very easy to do this.  The RichTextBox has an
event called ContentsResized.  One of the arguments of
that event is
System.Windows.Forms.ContentsResizedEventArgs.  This
argument has a property called NewRectangle, which has a
height. When this event fires you just need to set the
height of you RichTextBox to the height of the
NewRectangle.

Quote:
>-----Original Message-----
>I am trying to create a control, that is inherited from
>the RichTextBox control, that will detect when either
the
>text in the box has changed or the width of the control
>has changed and will resize the height of the control to
>fit the text.  I am having trouble figuring out what the
>exact height of the text is in the RichTextBox.  Does
>anyone have an idea about how to do this?

>.



Mon, 07 Mar 2005 01:02:02 GMT  
 Resize richtextbox to fit content
A better way to skin a cat!



Quote:
>Just in case anyone is interested....It turns out it is
>actually very easy to do this.  The RichTextBox has an
>event called ContentsResized.  One of the arguments of
>that event is
>System.Windows.Forms.ContentsResizedEventArgs.  This
>argument has a property called NewRectangle, which has a
>height. When this event fires you just need to set the
>height of you RichTextBox to the height of the
>NewRectangle.

>>-----Original Message-----
>>I am trying to create a control, that is inherited from
>>the RichTextBox control, that will detect when either
>the
>>text in the box has changed or the width of the control
>>has changed and will resize the height of the control to
>>fit the text.  I am having trouble figuring out what the
>>exact height of the text is in the RichTextBox.  Does
>>anyone have an idea about how to do this?

>>.



Mon, 07 Mar 2005 10:52:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Resize text object to fit contents?

2. Size to Fit Drawing Contents

3. How to size a browser control to fit the contents

4. How do you resize an image to fit a Picture box in VB .net

5. Graph resizes to fit a PictureBox Control

6. Graph resizes to fit a PictureBox Control

7. Resize ActiveX Control to Fit Internet Explorer

8. Resize a form to fit a picture

9. Resizing jpeg to fit PictureBox

10. Resizing Text to fit on Button

11. How to resize form to fit movie player file

12. resizing an image to fit my picturebox?

 

 
Powered by phpBB® Forum Software