1,你的说功能完全没有问题,做法如下:
创建一个类模块(名称"Class1"),然后在声明段添加下面语句
Public WithEvents Line As AcadLine
然后在同一类模块中加入下面过程作为Modified事件触发器:
Private Sub line_modified(ByVal pObject As AutoCAD.AcadObject) UserForm1.Show '加载你自定义的窗体 End Sub
创建一个模块,写入下面的代码:
Dim eventobj As New Class1 Sub main() Dim line1 As AcadLine Dim startPoint(2) As Double, endPoint(2) As Double startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0 endPoint(0) = 50: endPoint(1) = 50: endPoint(2) = 0
Set line1 = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint) Set eventobj.Line = line1 End Sub
代码写完了,末尾别忘了加上一个userform,运行一下就得到你的效果了
2,有了上面的程序,相信这个问题也好解决了吧 |