LineShape Constructor (Int32, Int32, Int32, Int32)
Initializes a new instance of the LineShape class, specifying the coordinates for the line.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
public LineShape(
int x1,
int y1,
int x2,
int y2
)
public:
LineShape(
int x1,
int y1,
int x2,
int y2
)
new :
x1:int *
y1:int *
x2:int *
y2:int -> LineShape
Public Sub New (
x1 As Integer,
y1 As Integer,
x2 As Integer,
y2 As Integer
)
Parameters
x1
Type: System.Int32The X (horizontal) coordinate of the starting point of the line.
y1
Type: System.Int32The Y (vertical) coordinate of the starting point of the line.
x2
Type: System.Int32The X (horizontal) coordinate of the ending point of the line.
y2
Type: System.Int32The Y (vertical) coordinate of the ending point of the line.
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 with the specified coordinates.
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
Microsoft.VisualBasic.PowerPacks.LineShape line1 =
new Microsoft.VisualBasic.PowerPacks.LineShape(0, 0, 1000, 1000);
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the LineShape.
line1.Parent = canvas;
Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Dim line1 As New Microsoft.VisualBasic.PowerPacks.LineShape(0,
0, 1000, 1000)
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the LineShape.
line1.Parent = canvas
See Also
ShapeContainer
Shape
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