2

我开始一个表格

if (Application.OpenForms.OfType<Form1>().Count() > 0)
{
    MessageBox.Show("form is open");
    //I want to bring the from to the top sine it is already running
}
else
{
    System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc1));
    t.Start();
}

public static void ThreadProc1()
{
    Application.Run(new Form1());
}

如果表单已经启动,我想将其置于顶部,而不仅仅是启动表单已打开的消息框。我已经进行了搜索,但似乎找不到有效的解决方案

4

0 回答 0