We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drawing a rectangle with text in it

Thread ID:





46062 Jul 5,2006 08:46 AM UTC Jul 13,2006 12:41 AM UTC WinForms 2
Tags: PDF
Asked On July 5, 2006 08:46 AM UTC

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

Ajish [Syncfusion]
Replied On 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.

Ajish [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon