gpt4 book ai didi

c# - 如何仅从一个表单更改所有表单的颜色?

转载 作者:太空宇宙 更新时间:2023-11-03 15:51:17 25 4
gpt4 key购买 nike

我试过:

//this code is triggered when i click a button on the form(lets call it form3)
// the first line works, but the second line is ReadOnly
this.BackColor = System.Drawing.Color.Crimson;
DefaultBackColor = this.BackColor;

在 form1 上,我有一个带有以下代码的按钮,没有注释,当我点击它时触发:

//this button is basically a refresh button for the background
this.BackColor = form3.DefaultBackColor;

我是 stackoverflow 的新手,所以非常感谢帮助,特别是如果可以提供替代代码的话。 :)

最佳答案

也许这可能有用?:Application.OpenForms

您可以遍历集合并以此方式设置表单颜色。

关于c# - 如何仅从一个表单更改所有表单的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25715416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com