B
BluDog
Hi
I am trying to draw text in a panel. I want the width of the panel to
be fixed but the height to be determined by the number of lines the
text needs to cover in the panel. I also want to be able to specify
the linespacing for the text.
I have looked at the StringFormat class, MSDN stating:
"Encapsulates text layout information (such as alignment and line
spacing)..."
However there appears to be no property for setting the Line Spacing
of the text, and I cannot work out how to wrap it...
Private Sub DrawText(ByVal e As PaintEventArgs)
Dim Text As String
Dim I As Integer
For I = 1 To 20
Text &= "Sample Text"
If I < 20 Then Text &= " "
Next
Dim TextSize As PointF
Dim StringFormat As New StringFormat
e.Graphics.DrawString(Text, Font, New SolidBrush(Color.Black),
0, 0, StringFormat.GenericTypographic)
End Sub
Any help would be appreciated!
Cheers
Blu.
I am trying to draw text in a panel. I want the width of the panel to
be fixed but the height to be determined by the number of lines the
text needs to cover in the panel. I also want to be able to specify
the linespacing for the text.
I have looked at the StringFormat class, MSDN stating:
"Encapsulates text layout information (such as alignment and line
spacing)..."
However there appears to be no property for setting the Line Spacing
of the text, and I cannot work out how to wrap it...
Private Sub DrawText(ByVal e As PaintEventArgs)
Dim Text As String
Dim I As Integer
For I = 1 To 20
Text &= "Sample Text"
If I < 20 Then Text &= " "
Next
Dim TextSize As PointF
Dim StringFormat As New StringFormat
e.Graphics.DrawString(Text, Font, New SolidBrush(Color.Black),
0, 0, StringFormat.GenericTypographic)
End Sub
Any help would be appreciated!
Cheers
Blu.