PictureFormat.CropLeft 属性 (PowerPoint)

返回或设置从指定图片或 OLE 对象的左侧裁剪下的磅值。 读/写。

语法

表达式CropLeft

表达 一个代表 PictureFormat 对象的变量。

返回值

单精度

备注

裁剪以相对于图片的原始尺寸计算。 例如,如果插入的图片,最初为 100 磅,将其高度调整为 200 磅,然后将 CropLeft 属性设置为 50,100 磅 (而不是 50) 将裁剪图片的左侧。

示例

此示例在 myDocument 中第三个形状的左侧裁剪了 20 磅。 仅当该图形是图片或 OLE 对象时,本示例才有效。

Set myDocument = ActivePresentation.Slides(1)

myDocument.Shapes(3).PictureFormat.CropLeft = 20

本示例实现的功能是:根据用户指定的百分比从左边裁剪所选图形,无论该图形是否经过缩放。 要使本示例执行,选定的形状必须是图片或 OLE 对象。

percentToCrop = InputBox("What percentage do you " & _
    "want to crop off the left of this picture?")

Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)

With shapeToCrop.Duplicate
    .ScaleWidth 1, True
    .Width = origWidth
    .Delete
End With

cropPoints = origWidth * percentToCrop / 100
shapeToCrop.PictureFormat.CropLeft = cropPoints

另请参阅

PictureFormat 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。