There's two fixes for this problem:
1) Use a modeless form. This includes adding document locks almost everywhere and is generally a pain in the butt.
2) Add a User Interaction, like this:
Private Sub PlotPreview()
Dim edUserInteraction As EditorUserInteraction = Application.DocumentManager.MdiActiveDocument.Editor.StartUserInteraction(Me)
Try
Me.Hide()
' Do your plot preview
Catch ex As System.Exception
' Error handling
Finally
edUserInteraction.End()
' Show the form
If Me.Visible = False Then Me.Show()
End Try
End Sub
The EditorUserInteraction object allows your modal form to give up focus and allow the plot preview to do what it's supposed to.
Simple fix for a very frustrating problem.
No comments:
Post a Comment