LineShape Constructor (ShapeContainer)
Initializes a new instance of the LineShape class, specifying the ShapeContainer where it will be parented.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
public LineShape(
ShapeContainer parent
)
public:
LineShape(
ShapeContainer^ parent
)
new :
parent:ShapeContainer -> LineShape
Public Sub New (
parent As ShapeContainer
)
Parameters
parent
Type: Microsoft.VisualBasic.PowerPacks.ShapeContainerA ShapeContainer where the shape will be parented
Remarks
A LineShape 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.
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);
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)
See Also
LineShape Overload
LineShape Class
Microsoft.VisualBasic.PowerPacks Namespace
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)
Return to top