sanket__96__
New member
- Joined
- Jul 10, 2021
- Messages
- 1
- Programming Experience
- 1-3
I'm working on word add-in, I have a button which when clicked opens a windows form using form.ShowDialog(). I want to close the form whenever user clicks outside the form area, I want to close because form.ShowDialog() doesn't allow me to minimise it and I'm saving the instance of the form before closing so that when user clicks the button again then the same instance of the form is opened(client requirement). I have word opened in the background of the form. I tried using the deactivate event, it works as expected only if I click on the taskbar. But it doesn't work if I click on the form background that is on the word document open in form background.
So, does anybody know any such event or work-around to fix this?
NOTE: I have tried using the following events:
Deactivate, Leave, MouseLeave, LostFocus. But none of these helped. I'm not using form.Show() because I want the execution to stop when the form is opened which form.ShowDialog() allows me to do.
So, does anybody know any such event or work-around to fix this?
NOTE: I have tried using the following events:
Deactivate, Leave, MouseLeave, LostFocus. But none of these helped. I'm not using form.Show() because I want the execution to stop when the form is opened which form.ShowDialog() allows me to do.