我需要在单击按钮时更改表单的背景图像,并在第二次单击时再次将其更改回 null,我该怎么做?
最佳答案
使用 BackgroundImage 属性:
form.BackgroundImage = image;
隐藏图片:
form.BackgroundImage = null;
将此源代码放入 ClickButton 方法:
form.BackgroundImage = form.BackgroundImage == null ? image : null;
关于c# - 如何以编程方式更改窗体上的背景图像#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1789967/