Table of contents
TOC
折叠目录
展开目录

PictureFormat.Recolor 方法 (发布服务器)PictureFormat.Recolor Method (Publisher)

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

更改出版物中图片的颜色。Changes the color of a picture in a publication.

语法Syntax

表达式重新着色颜色LeaveBlackPartsBlackexpression. Recolor( Color, LeaveBlackPartsBlack)

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

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
颜色Color必需RequiredColorFormatColorFormat用于重新着色的颜色。The color to be used for recoloring.
LeaveBlackPartsBlackLeaveBlackPartsBlack必需RequiredMsoTriStateMsoTriState如此如果以黑色的原始图片的所有部分都都应保留为黑色。True if all parts of the original picture that were black in color should be left black.

注解Remarks

重新着色方法对应于在图片重新着色对话框中可用的选项。(在格式菜单上,单击图片,然后单击重新着色The Recolor method corresponds to the options available in the Recolor Picture dialog box. (On the Format menu, click Picture, and then click Recolor)

示例Example

下面的 Microsoft Visual Basic for Applications (VBA) 宏显示如何使用重新着色方法来更改图片的颜色。它 recolors 出版物第一页上的Shapes集合中的第一个形状。之后运行的代码,可以使用RestoreOriginalColors方法恢复原始的颜色。The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the Recolor method to change the color of a picture. It recolors the first shape in the Shapes collection on the first page of the publication. After running the code, you can restore the original colors by using the RestoreOriginalColors method.

此示例正常运行,要进行重新着色的形状必须是图片或 OLE 对象表示图片。For this example to work, the shape to be recolored must be either a picture or an OLE object that represents a picture.

Public Sub Recolor_Example() 

 Dim pubPictureFormat As Publisher.PictureFormat 
 Dim pubShape As Publisher.Shape 
 Dim pubColorFormat As Publisher.ColorFormat 

 Set pubShape = ThisDocument.Pages(1).Shapes(1) 

 Set pubPictureFormat = pubShape.PictureFormat 
 Set pubColorFormat = pubShape.Fill.BackColor 

 pubPictureFormat.Recolor pubColorFormat, msoTrue 

End Sub
© 2018 Microsoft