如何重置.NET Windows窗体TextBox BackColor属性? [英] How do I reset a .NET Windows Forms TextBox BackColor property?
问题描述
TextBox
的属性 BackColor
的默认行为如下:启用时, White
( 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).
如果我改变 BackColor
属性,同样的颜色同时用于Enabled和Disabled。如何重置 BackColor
属性(以前已更改),以便行为恢复为默认值?
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.
推荐答案
如果你的意思是在设计器中,你可以点击BackColor属性,删除其中的任何东西,然后按回车。
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.
如果您的意思是在代码中,您可以将BackColor属性设置为 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窗体TextBox BackColor属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!