Groups | Blog | Home
all groups > dotnet drawing api > november 2004 >

dotnet drawing api : image from rtf


Steve Bugden
11/29/2004 3:47:01 AM
Hi,

I'm just wondering if it is possible to create an image from RTF formatted
text?

If it isn't possible, is there anyway of determining the height of an rtf
string for a given width? I have the text in a richtextbox control and would
like to set the height so that all of the text is displayed.

Thanks,

tommy.carlier NO[at]SPAM telenet.be
11/29/2004 11:41:24 PM
[quoted text, click to view]

I don't know how to create an image from RTF, but I do know how to get
the height for a given width. The RichTextBox control has an event
ContentsResized, that is called when the size of the content changes.
The event has an argument of type ContentsResizedEventArgs, that has a
property NewRectangle of type rectangle.

// myRTB is the RichTextBox

myRTB.ContentsResized += new
ContentsResizedEventHandler(myRTB_ContentsResized);

private void myRTB_ContentsResized(object sender,
ContentsResizedEventArgs e)
{
int height = e.NewRectangle.Height; // the new height
AddThis Social Bookmark Button