Table of contents

ColorFormat.RGB 属性 (发布服务器)ColorFormat.RGB Property (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

返回或设置表示指定颜色的红-绿-蓝 (RGB) 值的MsoRGBType 。读/写。Returns or sets an MsoRGBType that represents the red-green-blue (RGB) value of the specified color. Read/write.


表达式RGBexpression. RGB

_expression_A 表示ColorFormat对象的变量。_expression_A variable that represents a ColorFormat object.

返回值Return Value



以下示例在当前出版物的第一页上创建新的形状,并设置填充颜色为红色。This example creates a new shape to the first page of the active publication and sets the fill color to red.

Sub SetFill() 
 ActiveDocument.Pages(1).Shapes.AddShape(Type:=msoShape5pointStar, _ 
 Left:=100, Top:=100, Width:=100, Height:=100).Fill.ForeColor _ 
 .RGB = RGB(Red:=255, Green:=0, Blue:=0) 
End Sub

本示例返回当前文档的第一页上第一个形状的前景色的 RGB 值。本示例假定当前出版物的第一页上至少有一个形状。This example returns the value of the foreground color of the first shape on the first page of the active document. This example assumes that there is at least one shape on the first page of the active publication.

Sub ShowFillColor() 
 MsgBox "The RGB fill value of this shape is " &; _ 
 ActiveDocument.Pages(1).Shapes(1).Fill.ForeColor.RGB &; "." 
End Sub
© 2018 Microsoft