csharp winform modal window, able to click on main window
language c#, winform
how do i create a modal window or such a thing that when it still showing i would still be able to click or interac开发者_开发技巧t with the main window..
thanks.
put some code please or links..
Make the dialog non-modal (use Show
instead of ShowDialog
), and make it top-most (TopMost = true
)
Just use the overload of Form.Show() that takes a form as a parameter, like this:
Form f = new Form();
f.Show(this);
This will keep the form always on top of the form that calls it, but still let you click and access the calling form.
Some confusion here I think;
Modal is when the window blocks the underlying window, and must be closed to enable the underlying window to regain control. Form.ShowDialog(owner) is used to accomplish this.
Non-Modal is a window that is opened "in parallell" to the underlying window. Both windows can be accessed and respond to mouse and key events. Form.Show(owner) to accomplish this.
Modality by definition means that you are not able to click anywhere else. You can create another form and show it with Show() method.
Show() Method allows you to click anywhere while ShowDialog() won't
精彩评论