LineShape Class

Represents a control displayed as a horizontal, vertical, or diagonal line.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

[ToolboxBitmapAttribute(typeof(LineShape), "Microsoft.VisualBasic.PowerPacks.LineShape.bmp")]
public class LineShape : Shape

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.

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);

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions