This content has been marked as final.
Show 2 replies
-
Re: ViewChangeNotify Can not Fired
Gennadiy Tsybikov Nov 15, 2018 2:28 AM (in response to Win Lai)You have to assign iModelView variable first and then Attach Event Handlers. You can use either Class Constructor or Button Click Event Handler. In the example below I use Class Constructor:
Dim SwApp As New SldWorks.SldWorks Dim SwModel As ModelDoc2 Dim WithEvents iModelView As ModelView Sub New() SwModel = SwApp.ActiveDoc iModelView = SwModel.ActiveView AttachEventHandlers() End Sub Sub AttachEventHandlers() AddHandler iModelView.RepaintNotify, AddressOf Me.ModelView_RepaintNotify AddHandler iModelView.ViewChangeNotify, AddressOf Me.ModelView_swViewChangeNotify End Sub Sub DetachEventHandlers() RemoveHandler iModelView.RepaintNotify, AddressOf Me.ModelView_RepaintNotify RemoveHandler iModelView.ViewChangeNotify, AddressOf Me.ModelView_swViewChangeNotify End Sub Function ModelView_RepaintNotify(ByVal repaintTYpe As Integer) As Integer 'Fired Successful! Return 0 End Function Function ModelView_swViewChangeNotify(ByVal View As Object) As Integer MessageBox.Show("View has been changed.") Return 0 End Function
-
Re: ViewChangeNotify Can not Fired
Win Lai Nov 15, 2018 7:39 PM (in response to Gennadiy Tsybikov)thanks you very much,gennadiy.
it is OK now
-