ResizeCanvas
MetaImage.ResizeCanvas method
调整画布大小。
public abstract void ResizeCanvas(Rectangle newRectangle)
范围 | 类型 | 描述 |
---|---|---|
newRectangle | Rectangle | 新的矩形。 |
例子
以下示例显示如何在元文件(WMF 和 EMF)周围添加具有指定边距的边框。
[C#]
int borderLeft = 50;
int borderTop = 50;
int borderRight = 50;
int borderBottom = 50;
string dir = "c:\\aspose.imaging\\issues\\net\\3280\\";
string[] fileNames = new[] { "image1.emf", "image2.wmf" };
foreach (string fileName in fileNames)
{
string inputFilePath = dir + fileName;
string outputFilePath = dir + "AddBorder_" + fileName;
using (Aspose.Imaging.FileFormats.Emf.MetaImage image = (Aspose.Imaging.FileFormats.Emf.MetaImage)Aspose.Imaging.Image.Load(inputFilePath))
{
image.ResizeCanvas(new Aspose.Imaging.Rectangle(-borderLeft, -borderTop, image.Width + borderLeft + borderRight, image.Height + borderTop + borderBottom));
image.Save(outputFilePath);
}
}
也可以看看
- struct Rectangle
- class MetaImage
- 命名空间 Aspose.Imaging.FileFormats.Emf
- 部件 Aspose.Imaging