LineShape Class
Represents a control displayed as a horizontal, vertical, or diagonal line.
Assembly: Microsoft.VisualBasic.PowerPacks (in Microsoft.VisualBasic.PowerPacks.dll)
The LineShape control enables you to draw lines on a form or container at design time or run time.
When you add a Line or Shape control to a form or container, an invisible ShapeContainer object is created. The ShapeContainer acts as a drawing surface for the shapes within each container control; each ShapeContainer has a corresponding ShapeCollection that enables you to iterate through the Line and Shape controls.
When you create a LineShape control at run time, you must also create a ShapeContainer and set the Parent property of the LineShape to the ShapeContainer.
The following example creates a ShapeContainer and a LineShape, adds them to a form, and displays a vertical line from the top to the bottom of the form.
Private Sub DrawLine() Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer Dim line1 As New Microsoft.VisualBasic.PowerPacks.LineShape ' Set the form as the parent of the ShapeContainer. canvas.Parent = Me ' Set the ShapeContainer as the parent of the LineShape. line1.Parent = canvas ' Set the starting and ending coordinates for the line. line1.StartPoint = New System.Drawing.Point(Me.Width / 2, 0) line1.EndPoint = New System.Drawing.Point(Me.Width / 2, Me.Height) End Sub
System.MarshalByRefObject
System.ComponentModel.Component
Microsoft.VisualBasic.PowerPacks.Shape
Microsoft.VisualBasic.PowerPacks.LineShape