How to disable the parent form when a child form is active?

前端 未结 13 2215
闹比i
闹比i 2020-12-12 23:26

How to disable a parent form when child form is active using c#?

13条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 00:02

    Are you calling ShowDialog() or just Show() on your child form from the parent form?

    ShowDialog will "block" the user from interacting with the form which is passed as a parameter to ShowDialog.

    Within the parent you might call something like:

    MyChildForm childForm = new MyChildForm();
    
    childForm.ShowDialog(this);
    

    where this is the parent form.

提交回复
热议问题