WPS 基础接口 > 演示 API 参考 > PictureFormat > 属性 > PictureFormat.CropLeft 属性
返回或设置从指定图片或 OLE 对象的左侧裁剪下的磅值。可读/写 Single 类型。裁剪以相对于图片的原始尺寸计算。例如,如果插入的图片原始宽度为 100 磅,将其宽度调整为 200 磅,再将 CropLeft 属性设置为 50,则会从图片左侧裁剪 100 磅(而不是 50 磅)。

语法

表达式.CropLeft

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

返回值
Single

示例

本示例在 myDocument 中第三个形状的左侧裁剪了 20 磅。要使本示例执行,第三个形状必须是图片或 OLE 对象。

示例代码
let myDocument = ActivePresentation.Slides.Item(1)
myDocument.Shapes.Item(3).PictureFormat.CropLeft = 20

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

示例代码
let percentToCrop = prompt("What percentage do you want to crop off the left of this picture?")
let shapeToCrop = ActiveWindow.Selection.ShapeRange.Item(1)

let myPictureFormat = shapeToCrop.Duplicate()
    myPictureFormat.ScaleWidth(1, true)

let origHeight = myPictureFormat.Height
    myPictureFormat.Width = origWidth
    myPictureFormat.Delete()

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

CropLeft 属性 CropLeft 属性 删除图片左侧的某个部分? 左裁图像? 裁切左侧


请参阅