Drawing a rectangle with text in it

Hello! I am trying to draw a rectangle with text in it. Due to the fact that currently it is not possible to draw a rectangle that spans to the next page, i should check if there is enough space in the current page. the problem is, i didn''t find a way to get the required height of the rectangle before i draw the text. this is the code i tried: float docLine = 750; string msg="Draw text that wraps for multi line"; RectangleF LineRect=new RectangleF(new PointF(20,docLine),new SizeF(70,15)); RectangleF DrawRect=new RectangleF(new PointF(20,docLine),new SizeF(70,15)); string strRemaining=doc.Graphics.DrawMultiText(LineRect,msg,font,props); while(strRemaining != "") { LineRect.Y+=LineRect.Height; strRemaining=doc.Graphics.DrawMultiText(LineRect,strRemaining,font,props); } DrawRect.Height += (LineRect.Y-DrawRect.Y); doc.Graphics.DrawRectangle(DrawRect); if i try the value 600 for docLine, than the code works fine. Is there a way to find out how many times the while loop will run without using the DrawMultiText method? Thanks Liat

2 Replies

AJ Ajish Syncfusion Team July 6, 2006 06:34 PM UTC

Hi Liat, Sorry for the delay in getting back to you. I will consult with the development team regarding it and send you an update as soon as I hear back. Thanks, Ajish.


AJ Ajish Syncfusion Team July 13, 2006 12:41 AM UTC

Hi Liat, Sorry for the delay in getting back to you. Here is some code for setting borders arround the text. IPDFGraphicState props = doc.CreateGraphicState(); props.BorderSize.All = 3; props.BorderColors.All = Color.Green; and here is the pdf file generated using the above code: http://www.syncfusion.com/Support/user/uploads/Sample_40af4f0d.pdf However this fix will be available only on the next service pack and I will provide you an update regarding this as soon as it is available. Also can you create a Direct Trac support incident for this and so that we can work with you to get an intermediate build to you. Regards, Ajish.

Loader.
Up arrow icon