c# 如何一次将 WindowState、FormBorderStyle 和 Bounds 更改应用于多个窗体?

c# how to apply WindowState, FormBorderStyle and Bounds changes to multiple forms at once?

我在选项菜单中有一些按钮,我希望能够同时更改每个表单的样式。目前它仅适用于选项菜单本身,因为我使用了 "this."

   private void Fullscreen_toggle_Click(object sender, EventArgs e)
    {
        this.WindowState = FormWindowState.Normal;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.Bounds = Screen.PrimaryScreen.Bounds;
    }

    private void Windowed_toggle_Click(object sender, EventArgs e)
    {
        this.WindowState = FormWindowState.Maximized;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
    }

有什么方法可以使它在全球范围内适用吗?

像这样迭代 Application.OpenForms() 集合:

    private void Fullscreen_toggle_Click(object sender, EventArgs e)
    {
        foreach (Form frm in Application.OpenForms)
        {
            frm.WindowState = FormWindowState.Normal;
            frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            frm.Bounds = Screen.PrimaryScreen.Bounds;
        }     
    }