' Simple WinForm Application to draw a solid line ' Downloaded from www.publicjoe.co.uk ' ' This software is provided 'as-is', without any express or implied warranty. ' In no event will the author(s) be held liable for any damages arising from ' the use of this software. ' ' Permission is granted to anyone to use this software for any purpose, ' including commercial applications, and to alter it and redistribute it ' freely. Imports System Imports System.Drawing Imports System.Windows.Forms Public Class LinesDemo : Inherits Form 'Run the application Public Shared Sub Main() Application.Run(New LinesDemo()) End Sub Public Sub New() MyBase.New() Me.Text = "Lines Demo 1" Me.ClientSize = New Size(280, 200) End Sub Private Sub LinesDemo_Paint( ByVal sender As Object, _ ByVal e As PaintEventArgs) _ Handles MyBase.Paint ' Get Graphics Object Dim g As Graphics = e.Graphics ' Create Font Dim myFont As New Font( "Verdana", 20 ) ' Create Brush Dim myBrush As New SolidBrush( Color.Tomato ) ' Draw the String g.DrawString("Hello Mum!", myFont, myBrush, 40, 40) ' Create Pen Dim myPen As New Pen( Color.Black, 3 ) ' Draw the Line g.DrawLine( myPen, 40, 75, 200, 75 ) ' Now tidy up myFont.Dispose() myBrush.Dispose() myPen.Dispose() End Sub End Class