|
|
Title | Draw text filled with lines in VB .NET |
Keywords | filled text, outline text, text, region, SetClip, FillPath, DrawLine |
Categories | Graphics |
|
|
In the form's Paint event handler, create a GraphicsPath object. Use its AddString method to add the string to it.
Call the Graphics object's FillPath method to fill the text path with blue. Then call the Graphics object's DrawPath method to draw the outline in black.
|
|
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 in blue and outline it in black.
e.Graphics.FillPath(New SolidBrush(Color.Blue), _
text_path)
e.Graphics.DrawPath(New Pen(Color.Black, 3), text_path)
End Sub
|
|
|
|
|
|