AmbientProperties AmbientProperties AmbientProperties AmbientProperties Class


为顶级控件提供环境属性值。Provides ambient property values to top-level controls.

public ref class AmbientProperties sealed
public sealed class AmbientProperties
type AmbientProperties = class
Public NotInheritable Class AmbientProperties


环境属性是控件上的一个属性, 如果未设置, 则将从父控件中检索该属性。An ambient property is a property on a control that, if not set, is retrieved from the parent control. 如果控件没有父控件并且未设置属性, 则控件会尝试通过Site属性查找环境属性的值。If the control does not have a parent and the property is not set, the control tries to find the value of the ambient property through the Site property. 如果该控件没有放置在一起, 则该站点不支持环境属性, 或者未在AmbientProperties对象上设置该属性, 则使用其自己的Control默认值。If the control is not sited, the site does not support ambient properties, or the property is not set on the AmbientProperties object, the Control uses its own default values. 派生自Control类的某些对象可以设置属性, 即使您不这样做。Some objects derived from the Control class might set the property even if you do not. 例如, Form类始终ForeColor设置和BackColor属性。For example, the Form class always sets the ForeColor and BackColor properties.


AmbientProperties() AmbientProperties() AmbientProperties() AmbientProperties()

初始化 AmbientProperties 类的新实例。Initializes a new instance of the AmbientProperties class.


BackColor BackColor BackColor BackColor

获取或设置对象的环境背景色。Gets or sets the ambient background color of an object.

Cursor Cursor Cursor Cursor

获取或设置对象的环境光标。Gets or sets the ambient cursor of an object.

Font Font Font Font

获取或设置对象的环境字体。Gets or sets the ambient font of an object.

ForeColor ForeColor ForeColor ForeColor

获取或设置对象的环境前景色。Gets or sets the ambient foreground color of an object.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)