ResizeCanvas

MetaImage.ResizeCanvas method

Ridimensiona la tela.

public abstract void ResizeCanvas(Rectangle newRectangle)
ParametroTipoDescrizione
newRectangleRectangleIl nuovo rettangolo.

Esempi

Nell’esempio seguente viene illustrato come aggiungere un bordo con i margini specificati attorno a un metafile (WMF ed 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);
    }
}

Guarda anche