如何在 Visual Basic .NET 2005 中使用 DrawString 创建自动换行效果?
问问题
2464 次
2 回答
5
http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=286
您可以通过将 RectangleF 对象传递给 DrawString 方法来在矩形中绘制文本。GDI+ 将环绕文本以使其适合指定的矩形。例如:
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)
于 2009-04-25T06:21:20.403 回答
3
如果您为Graphics.DrawString方法的重载提供一个矩形,它会将文本包装在矩形内。
Overloads Public Sub DrawString(String, Font, Brush, RectangleF)
于 2009-04-25T06:26:12.590 回答