共用方式為


LineShape Constructor

Initializes a new instance of the LineShape class.

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

Syntax

'宣告
Public Sub New
public LineShape()
public:
LineShape()
new : unit -> LineShape
public function LineShape()

Remarks

A LineShape control cannot be displayed directly on a form or container control; it must be hosted on a ShapeContainer object. After you initialize a LineShape, you will have to set its Parent property either to an existing ShapeContainer or to a new instance of ShapeContainer.

Examples

The following example initializes a ShapeContainer and a LineShape, sets the Parent() property of the LineShape to the ShapeContainer, and displays a diagonal line.

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(0, 0)
line1.EndPoint = New System.Drawing.Point(1000, 1000)
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(0, 0);
line1.EndPoint = new System.Drawing.Point(1000, 1000);

.NET Framework Security

See Also

Reference

LineShape Class

LineShape Overload

Microsoft.VisualBasic.PowerPacks Namespace

ShapeContainer

Shape

Other Resources

How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)

How to: Draw Lines with the LineShape Control (Visual Studio)

Introduction to the Line and Shape Controls (Visual Studio)