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 Sub New ( _
parent As ShapeContainer _
)
public LineShape(
ShapeContainer parent
)
public:
LineShape(
ShapeContainer^ parent
)
new :
parent:ShapeContainer -> LineShape
public function LineShape(
parent : ShapeContainer
)
Parameters
- parent
Type: Microsoft.VisualBasic.PowerPacks.ShapeContainer
A 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.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks Namespace
Other Resources
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
How to: Draw Lines with the LineShape Control (Visual Studio)