首页 > 其他分享 >WinForm-通过窗口名找窗口

WinForm-通过窗口名找窗口

时间:2023-03-16 09:23:27浏览次数:36  
标签:名找 窗口 Form form ActiveForm Console FindForm WinForm

// 找活动状态中的窗口
Form form = Form.ActiveForm.FindForm();
Console.WriteLine("ActiveForm.FindForm:" + form.GetType());

// 找应用中的窗口
FormCollection formCollection = Application.OpenForms;
foreach (Form formNO in formCollection)
{
    if (formNO is Form1 form1)
    {
        Console.WriteLine("FormCollection.FindForm:" + form.GetType());
        // form1.StatusBarShow(sCADABool, mQTTBool, triggerBool);
        return;
    }
}

标签:名找,窗口,Form,form,ActiveForm,Console,FindForm,WinForm
From: https://www.cnblogs.com/qq2806933146xiaobai/p/17221097.html

相关文章