前景色属性 (Microsoft Forms)ForeColor property (Microsoft Forms)

指定对象的前景色Specifies the foreground color of an object.

语法Syntax

对象前景色[= Long ]object.ForeColor [= Long ]

ForeColor 属性的语法包含以下部分:The ForeColor property syntax has these parts:

PartPart 说明Description
objectobject 必需。Required. 一个有效的对象。A valid object.
LongLong 可选。Optional. 确定对象前景色的值或常量。A value or constant that determines the foreground color of an object.

设置Settings

您可以使用任何表示有效颜色的整数。You can use any integer that represents a valid color. 您还可以使用带有红色、绿色和蓝色分量的 RGB 函数指定颜色。You can also specify a color by using the RGB function with red, green, and blue color components. 每个颜色分量的值都是一个范围在 0 和 255 之间的整数。The value of each color component is an integer that ranges from zero to 255. 例如,您可以将青绿色指定为整数值 4966415,或指定为红色、绿色和蓝色分量 (15, 200, 75)。For example, you can specify teal blue as the integer value 4966415 or as red, green, and blue color components 15, 200, 75.

备注Remarks

对窗体上的控件使用 ForeColor 属性可以使其更易于阅读或传达特殊意义。Use the ForeColor property for controls on forms to make them easy to read or to convey a special meaning. 例如,如果某个文本框用于报告库存量,则可以在该值降到再订购线以下时更改文本的颜色。For example, if a text box reports the number of units in stock, you can change the color of the text when the value falls below the reorder level.

对于**滚动条** 或数值**调节钮**,前景色设置箭头的颜色。For a ScrollBar or SpinButton, ForeColor sets the color of the arrows.

对于**Frame**,前景色将更改标题的颜色。For a Frame, ForeColor changes the color of the caption.

对于**Font** 对象,前景色确定文本的颜色。For a Font object, ForeColor determines the color of the text.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.