When developing a WinForms application, I came across what, in my opinion, is an error in the OpenFileDialog and SaveFileDialog elements. Another person appeared on a Google search who noticed the same problem, but no solution or workaround was provided. You can view this topic: http://bytes.com/topic/visual-basic-net/answers/389470-open-file-dialog-picturebox-click-event .
I have a custom control in my form that handles the MouseDown event. If I double-clicked a file in a FileDialog control when the mouse is over this control (obviously, with a dialog between them), the MouseDown event is fired. I donβt think this is a problem with my control because the person I mentioned noticed that this is happening with the PictureBox control. It would seem that although the mouse button was pressed (for a second click to open the file), while in the dialog the event passed through the form and my control when the dialog is closed.
I tried to disable my control while the dialog was active, but that did not stop it from capturing the event. I assume this is because the event is dispatched after the dialog box closes, so my control will be turned back on. Does anyone know how to prevent this click from getting into the form and, in turn, my control? Also, can anyone confirm if this is really a bug in the FileDialog elements, or if I have an incorrect setting?
c # winforms mouseevent filedialog double-click
Shaun hamman
source share