Private Sub Form1_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles _
MyBase.Paint
Dim text_path As GraphicsPath
' Create the text path.
text_path = New System.Drawing.Drawing2D.GraphicsPath( _
Drawing.Drawing2D.FillMode.Alternate)
text_path.AddString("Flowers", _
New FontFamily("Times New Roman"), _
FontStyle.Bold, 200, _
New Point(10, 10), _
StringFormat.GenericDefault)
' Fill the path with blue.
e.Graphics.FillPath(New SolidBrush(Color.Blue), _
text_path)
' Use the path as the Graphics
' object's clipping region.
e.Graphics.SetClip(text_path)
' Draw small text on the form.
Const inner_text = "rose tulip carnation daffodil " & _
"peopny daisy dandelion snapdragon pansy "
Dim inner_font As New Font( _
New FontFamily("Times New Roman"), _
8, FontStyle.Regular)
Dim inner_brush As New SolidBrush(Color.Black)
Dim inner_text_width As Single
Dim inner_text_height As Single
Dim x As Single
Dim y As Integer
' See how big the inner string is.
inner_text_width = e.Graphics.MeasureString( _
inner_text, inner_font).Width
inner_text_height = e.Graphics.MeasureString( _
inner_text, inner_font).Height
' Draw the inner text.
y = 0
Do While y <= Me.Height
x = -y
Do While x <= Me.Width
e.Graphics.DrawString( _
inner_text, inner_font, inner_brush, x, y)
x += inner_text_width
Loop
y = y + inner_text_height
Loop
End Sub
|