Modal form doesn't appear in tray until minimized and owner-form is clicked once. How do I make it appear?

泄露秘密 提交于 2019-12-25 02:15:32

问题


("Click on owner-form" doesn't count. :))

I have:

public partial class Form1 : Form
{
    Form2 frm2 = new Form2();

    public Form1()
    {
        InitializeComponent();
        frm2.Owner = this;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        frm2.ShowDialog();
    }
}

回答1:


Just change the owner setting from

frm2.Owner = this;

to

frm2.ShowDialog(this);

(Credit goes to gerald-p-wright)



来源:https://stackoverflow.com/questions/8704921/modal-form-doesnt-appear-in-tray-until-minimized-and-owner-form-is-clicked-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!