LineShape 构造函数 (ShapeContainer)
初始化 LineShape 类的新实例,指定它将父节点的 ShapeContainer 。
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
Public Sub New ( _
parent As ShapeContainer _
)
public LineShape(
ShapeContainer parent
)
public:
LineShape(
ShapeContainer^ parent
)
new :
parent:ShapeContainer -> LineShape
public function LineShape(
parent : ShapeContainer
)
参数
- parent
类型:Microsoft.VisualBasic.PowerPacks.ShapeContainer
形状将父节点的 ShapeContainer
备注
LineShape 直接在窗体或容器控件无法显示;在 ShapeContainer 对象必须承载它。 在初始化 LineShape后,必须将其 Parent 属性设置为现有 ShapeContainer 或到 ShapeContainer的新实例。
示例
下面的示例初始化 ShapeContainer 和 LineShape,设置 LineShape 的 Parent 属性设置为 ShapeContainer,并显示一行对角线。
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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间
其他资源
如何:使用 OvalShape 和 RectangleShape 控件绘制形状 (Visual Studio)