lihezhou 发表于 2019-7-31 22:50:00

退出时BeginQuit事件返回的Cancel不起效!

Imports
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Public Class BHNET
    Dim WithEvents QCADapp As AcadApplication
    Private Sub QCADapp_BeginQuit(ByRef Cancel As Boolean) Handles QCADapp.BeginQuit
      On Error Resume Next
      If MsgBox("AutoCAD即将退出,你确定退出吗?", vbYesNoCancel + vbQuestion, "Auto CAD")vbYes Then
            Cancel = True
      End If
    End Sub
    Public Sub New()
    End Sub
    Protected Overrides Sub Finalize()
      MyBase.Finalize()
    End Sub
   
    Public Sub Show()
      QCADapp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
    End Sub
End Class
这个代码怎么在CAD退出的时候,点击了NO不起效呢?如果是在CAD没有活动文档的时候点击NO是不会退出的。如果有文档的时候点击CAD关闭就会不起效!哪位大神用VB.net的。帮我看看

烟盒迷唇 发表于 2019-8-1 19:29:00

发表的板块不对吧
页: [1]
查看完整版本: 退出时BeginQuit事件返回的Cancel不起效!