Represents a control displayed as a horizontal, vertical, or diagonal line.
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.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.
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.
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas = new Microsoft.VisualBasic.PowerPacks.ShapeContainer(); Microsoft.VisualBasic.PowerPacks.LineShape line1 = new Microsoft.VisualBasic.PowerPacks.LineShape(); // Set the form as the parent of the ShapeContainer. canvas.Parent = this; // 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(this.Width / 2, 0); line1.EndPoint = new System.Drawing.Point(this.Width / 2, this.Height);