<pre name="code" >Dim acadapp As AcadApplication '在窗体代码声明段定义acadappPrivate Sub Command1_Click()acadapp.documents.Add '创建新的图形文件End SubPrivate Sub Command2_Click()Dim myfilename As StringMe.CommonDialog1.ShowOpenmyfilename = Me.CommonDialog1.filenameIf myfilename <> "" Then acadapp.documents.Open myfilenameEnd IfEnd SubPrivate Sub Command3_Click()Dim savename As StringMe.CommonDialog1.ShowSavesavename = Me.CommonDialog1.filenameIf savename <> "" Then acadapp.Activedocument.SaveAs savenameEnd IfEnd SubPrivate Sub Command4_Click()If Not acadapp.Activedocument.Saved Then If MsgBox("是否保存文件?",vbYesNo) = vbYes Then acadapp.Activedocument.Save End IfEnd IfEnd SubPrivate Sub Command5_Click()acadapp.Activedocument.Close (True) '以当前文件名和路径保存修改后的图形文件,然后关闭文件,若为False则不修改即保存End SubPrivate Sub Form_Load()On Error Resume NextSet acadapp = Getobject(,"autocad.application")If Err Then Err.Clear Set acadapp = CreateObject("autocad.application") If Err Then MsgBox ("不能运行autoCad,请检查是否安装了CAD") Exit Sub End IfEnd Ifacadapp.Visible = TrueEnd Sub总结
以上是内存溢出为你收集整理的VB CAD插件二次开发全部内容,希望文章能够帮你解决VB CAD插件二次开发所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)