ResizeCanvas

MetaImage.ResizeCanvas method

Ändrar storleken på duken.

public abstract void ResizeCanvas(Rectangle newRectangle)
ParameterTypBeskrivning
newRectangleRectangleDen nya rektangeln.

Exempel

Följande exempel visar hur man lägger till en ram med de angivna marginalerna runt en metafil (WMF och 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);
    }
}

Se även