我在选项菜单中有按钮,我希望能够一次更改每个表单的样式。目前它只适用于选项菜单本身,因为我已经使用过"这个。"
A
有没有办法让这个全球适用?
答案 0 :(得分:0)
像这样迭代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;
}
}