Line shape是VisualBasic power pack 1.0(在vs2010中)的工具之一,
当我将标签属性添加到容器控件时,如何定义标签属性并为其设置值:
我的代码在下面并且(在设计时)需要
public class MyLine:Microsoft.VisualBasic.PowerPacks.LineShape
{
public Label label ;
public MyLine()
{
}
public MyLine(ShapeContainer container)
: base(container)
{
label = new Label() { Text = "Ali_Sarshogh" };
}
}
///--------- 以主表单调用:
private Microsoft.VisualBasic.PowerPacks.ShapeContainer shapeContainer1;
//--- in Button1_Click() i want to draw it :
MyLine lineShape1 = new MyLine(shapeContainer1);
lineShape1.Name = "lineShape1";
lineShape1.X1 = 25;
lineShape1.X2 = 160;
lineShape1.Y1 = 18;
lineShape1.Y2 = 17;
this.shapeContainer1.Shapes.Add(lineShape1);
结果:在表单上绘制了线条,但标签不可见