views:

868

answers:

3

hai how to do word wrap in drawstring in vb.net 2005. please tell me

+2  A: 

http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=286

You can draw text in a rectangle by passing a RectangleF object to the DrawString method. GDI+ will wrap the text to make it fit in the specified rectangle. For example:

Dim s As String = "This string will be wrapped in the output rectangle"
Dim rectf As New RectangleF(10, 100, 200, 200)
grf.DrawString(s, myFont, Brushes.Red, rectf)
Sören Kuklau
+1  A: 

If you provide a rectangle to an overload of the Graphics.DrawString method, it will wrap the text within the rectangle.

Overloads Public Sub DrawString(String, Font, Brush, RectangleF)

Indolent Code Monkey
A: 

just wanted to say thanks to Soren. Used this on a printout, didn't want the rectangle on the printout so just made the border white and wah lah. Thanks dude.

mike