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
'Declaration
Public Sub New ( _
x1 As Integer, _
y1 As Integer, _
x2 As Integer, _
y2 As Integer _
)
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 function LineShape(
x1 : int,
y1 : int,
x2 : int,
y2 : int
)
Parameters
- x1
Type: System.Int32
The X (horizontal) coordinate of the starting point of the line.
- y1
Type: System.Int32
The Y (vertical) coordinate of the starting point of the line.
- x2
Type: System.Int32
The X (horizontal) coordinate of the ending point of the line.
- y2
Type: System.Int32
The 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.
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
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;
.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)