如何重置一个.NET Windows窗体文本框背景色属性? [英] How do I reset a .NET Windows Forms TextBox BackColor property?

查看:330
本文介绍了如何重置一个.NET Windows窗体文本框背景色属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

属性背景色的默认行为文本框如下:当启用时,它 SystemColors.Window ),当禁用它格雷(不知道是什么的SystemColor这是)。

The default behavior of property BackColor of a TextBox is as follows: when enabled, it is White (SystemColors.Window), when disabled it is Gray (not sure what SystemColor this is).

如果我修改背景色属性,相同的颜色用于启用和禁用的。我如何重置背景色属性(后已更改previously),这样的行为将恢复为默认?

If I change the BackColor property, the same color is used for both Enabled and Disabled. How do I reset the BackColor property (after it has been changed previously) so that the behavior reverts to the default?

我已经尝试设置回 SystemColors.Window ,但随即被禁用时,盒子保持白色。

I have tried setting it back to SystemColors.Window, but then the box stays white when disabled.

推荐答案

如果您在设计师的意思是,你可以点击进入背景色属性并删除无论是在那里,然后preSS进入。这将重置属性恢复为默认值。

If you mean in the designer, you can just click into the BackColor property and delete whatever is in there and then press enter. This will reset the property back to its default value.

如果您在code的意思是,你可以设置背景色属性设置为<一个href="http://msdn.microsoft.com/en-us/library/system.drawing.color.empty%28v=vs.110%29.aspx">Color.Empty,这将有同样的效果。

If you mean in code, you can set the BackColor property to Color.Empty, and this will have the same effect.

这篇关于如何重置一个.NET Windows窗体文本框背景色属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆