Class MetafileRecorderGraphics2D

Class MetafileRecorderGraphics2D

Der Name: Aspose.Imaging.FileFormats.Emf.Graphics Versammlung: Aspose.Imaging.dll (25.4.0)

Die Metaphysen aufzeichnen Grafiken

public abstract class MetafileRecorderGraphics2D

Inheritance

object MetafileRecorderGraphics2D

Derived

EmfRecorderGraphics2D , WmfRecorderGraphics2D

Vererbte Mitglieder

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Properties

BackgroundColor

Sie erhalten oder legen die Farbe des Hintergrunds fest.

public Color BackgroundColor { get; set; }

Eigentumswert

Color

BackgroundMode

Erhalten oder setzen Sie den Hintergrundmodus.

protected int BackgroundMode { get; set; }

Eigentumswert

int

Clip

Erhalten oder festlegen Sie eine Region, die die Zeichnungsregion dieser Grafik beschränkt

public Region Clip { get; set; }

Eigentumswert

Region

ClipBounds

Er bekommt die Klipgrenzen.

public RectangleF ClipBounds { get; }

Eigentumswert

RectangleF

Methods

Clear()

Erläutert den Zustand des Grafikobjekts

public void Clear()

DrawArc(Pen, Rectangle, Flut, Flut)

Draht ein Loch, das eine Portion einer Ellipse darstellt, die durch eine Rectangle Struktur angegeben ist.

public void DrawArc(Pen pen, Rectangle rect, float startAngle, float arcAngle)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

rect Rectangle

Die Grenzen der Ellipse.

startAngle float

Winkel in Grad gemessen Uhrwesen von der X-Axi bis zum Ausgangspunkt des Arc.

arcAngle float

Winkel in Graden gemessen Uhrwesen von der StartWinkel-Parameter bis zum Ende Punkt des Arc.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

DrawCubicBezier(Stück, Punkt, Punkt, Punkt)

Der kubische Bezier.

public void DrawCubicBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

pt1 Point

Der Ausgangspunkt der Kurve.

pt2 Point

Der erste Kontrollpunkt für die Kurve.

pt3 Point

Der zweite Kontrollpunkt für die Kurve.

pt4 Point

Der Endpunkt der Kurve.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

DrawEllipse(Pen und Rectangle)

Entfernen Sie die Ellipse.

public void DrawEllipse(Pen pen, Rectangle rect)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

rect Rectangle

Die Grenzen der Ellipse.

DrawImage(RasterImage, Punkt)

Zeichnen Sie das angegebenen Bild, mit seiner ursprünglichen physischen Größe, an der angegebenen Stelle.

public void DrawImage(RasterImage image, Point location)

Parameters

image RasterImage

Das Bild zum Zeichnen.

location Point

Die Lage der oberen linken Ecke des entworfenen Bildes.

DrawImage(RasterImage, Rectangle, Rectangle, GraphicsUnit)

Zeichnen Sie den angegebenen Teil des angegebenen Bildes an der angegebenen Lage und mit der angegebenen Größe.

public void DrawImage(RasterImage image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)

Parameters

image RasterImage

Das Bild zum Zeichnen.

destRect Rectangle

Rectangle-Struktur, die die Lage und Größe des entworfenen Bildes angibt. Das Bild wird geschnitten, um den Rechteck zu passen.

srcRect Rectangle

Rectangle-Struktur, die den Teil des Bildobjekts angibt, den man ziehen soll.

srcUnit GraphicsUnit

Die Einheiten der Messung, die durch den srcRect-Parameter verwendet werden.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

Exceptions

ArgumentOutOfRangeException

srcUnit;Support nur Pixel-Einheit

DrawImage(byte[][], Rectangle, GraphicsUnit)

Tragen Sie das Bild.

public void DrawImage(byte[] imageBytes, Rectangle destRect, GraphicsUnit srcUnit)

Parameters

imageBytes byte [][]

Das Bild bytes.

destRect Rectangle

Die rechte Rechte.

srcUnit GraphicsUnit

Die Quellinheit.

DrawImage(Stream, Rectangle und GraphicsUnit)

Tragen Sie das Bild.

public void DrawImage(Stream stream, Rectangle destRect, GraphicsUnit srcUnit)

Parameters

stream Stream

Der Strom.

destRect Rectangle

Die rechte Rechte.

srcUnit GraphicsUnit

Die Quellinheit.

DrawLine(Pen, int, int, int, int)

Drücken Sie die Linie.

public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

x1 int

Die X-Koordinate des ersten Punkts.

y1 int

Die Y-Koordinate des ersten Punkts.

x2 int

Die X-Koordinate des zweiten Punkts.

y2 int

Die Y-Koordinate des zweiten Punkts.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

DrawLine(Stück, Punkt und Punkt)

Drücken Sie die Linie.

public void DrawLine(Pen pen, Point pt1, Point pt2)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

pt1 Point

Der erste Punkt.

pt2 Point

Der zweite Punkt.

DrawPath(Pen und GraphicsPath)

Drehen Sie den Weg.

public void DrawPath(Pen pen, GraphicsPath path)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

path GraphicsPath

Der Weg zum Zeichnen.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

DrawPie(Pen, Rectangle, Flut, Flut)

Drücken Sie den Pie.

public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

rect Rectangle

Die Grenzen der Ellipse.

startAngle float

Winkel in Grad gemessen Uhrwesen von der X-Axi bis zum Ausgangspunkt des Arc.

sweepAngle float

Winkel in Graden gemessen Uhrwesen von der StartWinkel-Parameter bis zum Ende Punkt des Arc.

DrawPolyCubicBezier(Stück, Punkt[])

Die Poly Cubic Bezier.

public void DrawPolyCubicBezier(Pen pen, Point[] points)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

points Point [][]

Die Punkte.

Exceptions

ArgumentOutOfRangeException

Die Anzahl der Punkte in der Reihe sollte ein Multiple von 3 plus 1 sein, wie z. B. 4, 7 oder 10.

DrawPolygon(Stück, Punkt[])

Die Polygone drücken.

public void DrawPolygon(Pen pen, Point[] points)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

points Point [][]

Die Punkte.

DrawPolyline(Stück, Punkt[])

Die Polylin drücken.

public void DrawPolyline(Pen pen, Point[] points)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

points Point [][]

Die Punkte.

DrawRectangle(Pen, int, int, int, int)

Drehen Sie den Rechteck.

public void DrawRectangle(Pen pen, int x, int y, int width, int height)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

x int

Die x-Koordinate des oberen linken Ecks des Rechteckens zum Zeichnen.

y int

Der Y-Koordinat des oberen linken Winkel des Rechteckens zum Zeichnen.

width int

Die Breite des Rechteckens zum Zeichnen.

height int

Die Höhe des Rechteckens zum Zeichnen.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

DrawRectangle(Pen und Rectangle)

Drehen Sie den Rechteck.

public void DrawRectangle(Pen pen, Rectangle rectangle)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

rectangle Rectangle

Die rechte Ecke zum Zeichnen.

DrawString(String, Font, Farbe, int, int)

Drücken Sie den String.

public void DrawString(string @string, Font font, Color color, int x, int y)

Parameters

string string

und der String.

font Font

Schrift, die das Textformat der Zeile definiert.

color Color

Die Textfarbe.

x int

Die x-Koordinate des oberen linken Winkel des getragenen Textes.

y int

Der y-Koordinat des oberen linken Winkel des getragenen Textes.

Examples

Dieses Beispiel zeigt, wie man ein EMF-Bild aus einem Datei laden und einen Textstreifen über ihn drücken kann.

string dir = "c:\\temp\\";

                                                                                                 using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(dir + "test.emf"))
                                                                                                 {
                                                                                                     Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D.FromEmfImage(emfImage);

                                                                                                     // First, get the image size
                                                                                                     int width = emfImage.Width;
                                                                                                     int height = emfImage.Height;

                                                                                                     // Second, calculate a transformation to put a text string along the main diagonal of the image -
                                                                                                     // from the upper-left to the bootom-right corner.
                                                                                                     float emFontSize = 96f;
                                                                                                     float d = (float)System.Math.Sqrt(width * width + height * height);
                                                                                                     float scaleFactor = d / (emFontSize * 5f);

                                                                                                     float tan = ((float)height) / width;                
                                                                                                     double radians = System.Math.Atan(tan);
                                                                                                     double degrees = (180 * radians) / System.Math.PI;

                                                                                                     Aspose.Imaging.Matrix transform = new Aspose.Imaging.Matrix();
                                                                                                     transform.Rotate((float)degrees);
                                                                                                     transform.Scale(scaleFactor, scaleFactor);

                                                                                                     // Then, set the transform.
                                                                                                     graphics.SetTransform(transform);

                                                                                                     // Finally, put a watermark (text string of pink color) along the main diagonal.
                                                                                                     graphics.DrawString("WATERMARK", new Aspose.Imaging.Font("Courier New", emFontSize), Aspose.Imaging.Color.LightPink, 0, 0/*, (float)degrees*/);

                                                                                                     // Save the image with watermark to another EMF file.
                                                                                                     using (Aspose.Imaging.FileFormats.Emf.EmfImage scaledEmfImage = graphics.EndRecording())
                                                                                                     {
                                                                                                         scaledEmfImage.Save(dir + "test.scaled.emf");
                                                                                                     }
                                                                                                 }

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

DrawString(String, Font, Farbe, int, int, float)

Drücken Sie den String.

public void DrawString(string @string, Font font, Color color, int x, int y, float angle)

Parameters

string string

und der String.

font Font

Schrift, die das Textformat der Zeile definiert.

color Color

Die Textfarbe.

x int

Die x-Koordinate des oberen linken Winkel des getragenen Textes.

y int

Der y-Koordinat des oberen linken Winkel des getragenen Textes.

angle float

Der Winkel in Grad, zwischen dem Fluchtvektor und dem X-Axi des Geräts.Der Fluchtvektor ist parallel zur Basislinie einer Textrad.

ExcludeClip(Rectangle)

Aktualisieren Sie die Clip-Region dieser Grafik, um das von einer Rectangle-Struktur angegebenen Bereich auszuschließen.

public void ExcludeClip(Rectangle rect)

Parameters

rect Rectangle

Rectangle-Struktur, die den Rechtangle angibt, um aus der Klipregion auszuschließen.

ExcludeClip(Region)

Aktualisieren Sie die Grafik-Clip-Region, um die von einer Region angegebenen Region auszuschließen.

public void ExcludeClip(Region region)

Parameters

region Region

Region, in der die Region angegeben wird, um aus der Clip-Region auszuschließen.

FillEllipse(Brush und Rectangle)

Fülle die Ellipse.

public void FillEllipse(Brush brush, Rectangle rect)

Parameters

brush Brush

Brush, die die Merkmale der Füllung bestimmt.

rect Rectangle

Die Grenzen der Ellipse.

FillPath(Pen, Brush und GraphicsPath)

Fülle den Weg.

public void FillPath(Pen pen, Brush brush, GraphicsPath path)

Parameters

pen Pen

Pen, die die Farbe, Breite und Stil der Figur bestimmt.

brush Brush

Brush, die die Merkmale der Füllung bestimmt.

path GraphicsPath

Der Weg zu füllen.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

FillPie(Brush, Rectangle, Flut, Flut)

Fülle die Fülle.

public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle)

Parameters

brush Brush

Brush, die die Merkmale der Füllung bestimmt.

rect Rectangle

Die Grenzen der Ellipse.

startAngle float

Winkel in Grad gemessen Uhrwesen von der X-Axi bis zum Ausgangspunkt des Arc.

sweepAngle float

Winkel in Graden gemessen Uhrwesen von der StartWinkel-Parameter bis zum Ende Punkt des Arc.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

FillPolygon(Brush, Punkt[])

Füllen Sie den Polygon.

public void FillPolygon(Brush brush, Point[] points)

Parameters

brush Brush

Brush, die die Merkmale der Füllung bestimmt.

points Point [][]

Die Punkte.

FillPolygon(Brush, Punkt[][], und FillMode)

Füllen Sie den Polygon.

public void FillPolygon(Brush brush, Point[] points, FillMode fillMode)

Parameters

brush Brush

Brush, die die Merkmale der Füllung bestimmt.

points Point [][]

Die Punkte.

fillMode FillMode

Die Füllmodus ausfüllen.

FillRectangle(Brush und Rectangle)

Füllen Sie den Rechteck.

public void FillRectangle(Brush brush, Rectangle rectangle)

Parameters

brush Brush

Brush, die die Merkmale der Füllung bestimmt.

rectangle Rectangle

Die rechte Ecke zu füllen.

Examples

Dieses Beispiel zeigt, wie man ein WMF-Bild erstellen und einige geometrische Formen mit WmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                   int imageWidth = 600;
                                                                                                                   int imageHeight = 400;

                                                                                                                   // This is the default screen resolution.
                                                                                                                   int dpi = 96;

                                                                                                                   Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight);

                                                                                                                   // Create a WMF image.
                                                                                                                   Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D graphics =
                                                                                                                       new Aspose.Imaging.FileFormats.Wmf.Graphics.WmfRecorderGraphics2D(frame, dpi);

                                                                                                                   // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);

                                                                                                                   // Fill a rectangle with the color of white-smoke.
                                                                                                                   graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                   // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
                                                                                                                   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);

                                                                                                                   // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                   // Fill an arc
                                                                                                                   graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                   // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                       new Aspose.Imaging.Point(0, 0),
                                                                                                                       new Aspose.Imaging.Point(200, 133),
                                                                                                                       new Aspose.Imaging.Point(400, 166),
                                                                                                                       new Aspose.Imaging.Point(600, 400));

                                                                                                                   // Draw a raster image of the specified size at the specified location.
                                                                                                                   // The image is scaled to fit the desired rectangle.
                                                                                                                   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                   {
                                                                                                                       graphics.DrawImage(imageToDraw,
                                                                                                                           new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                           new Aspose.Imaging.Rectangle(0, 0, imageWidth, imageHeight),
                                                                                                                           Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                   }

                                                                                                                   // Draw a text string
                                                                                                                   graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                   // Create a path to fill
                                                                                                                   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                   figureToFill.IsClosed = true;

                                                                                                                   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                   pathToFill.AddFigure(figureToFill);

                                                                                                                   figureToFill.AddShapes(new Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                           new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 200),
                                                                                                                                   new Aspose.Imaging.PointF(400, 200),
                                                                                                                                   new Aspose.Imaging.PointF(500, 100),
                                                                                                                                   new Aspose.Imaging.PointF(600, 200),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                               new Aspose.Imaging.PointF[]
                                                                                                                               {
                                                                                                                                   new Aspose.Imaging.PointF(300, 100),
                                                                                                                               }),
                                                                                                                           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                       });

                                                                                                                   // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                   // Create a path to draw
                                                                                                                   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                   pathToDraw.AddFigure(figureToDraw);

                                                                                                                   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                       {
                                                                                                                           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                       });

                                                                                                                   // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                   // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                   Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                   Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                   saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                   // Get the final WMF image which includes all drawing commands
                                                                                                                   using (Aspose.Imaging.FileFormats.Wmf.WmfImage wmfImage = graphics.EndRecording())
                                                                                                                   {
                                                                                                                       wmfImage.Save(dir + "test.output.wmf");
                                                                                                                   }

Dieses Beispiel zeigt, wie man ein EMF-Bild erstellen und einige geometrische Formen auf ihm mit EmfRecorderGraphics2D zeichnen kann.

string dir = "c:\\temp\\";

                                                                                                                         // The image size in pixels
                                                                                                                         int deviceWidth = 600;
                                                                                                                         int deviceHeight = 400;

                                                                                                                         // The image size in millimiters
                                                                                                                         int deviceWidthMm = (int)(deviceWidth / 100f);
                                                                                                                         int deviceHeightMm = (int)(deviceHeight / 100f);

                                                                                                                         Aspose.Imaging.Rectangle frame = new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Create a EMF image.
                                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                                             new Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D(
                                                                                                                                 frame,
                                                                                                                                 new Aspose.Imaging.Size(deviceWidth, deviceHeight),
                                                                                                                                 new Aspose.Imaging.Size(deviceWidthMm, deviceHeightMm));

                                                                                                                         // Draw a black rectangle along the image borders using a 1-pixel-wide black pen.
                                                                                                                         graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, deviceWidth, deviceHeight);

                                                                                                                         // Fill a rectangle with the color of white-smoke.
                                                                                                                         graphics.FillRectangle(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), new Aspose.Imaging.Rectangle(10, 10, 580, 380));

                                                                                                                         // Draw two diagonal lines using a 1-pixel-wide darkgreen pen.
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, deviceWidth, deviceHeight);
                                                                                                                         graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, deviceHeight, deviceWidth, 0);

                                                                                                                         // Draw an arc within the rectangle {0, 0, 200, 200} using a 2-pixel-wide blue pen.
                                                                                                                         graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);

                                                                                                                         // Fill an arc
                                                                                                                         graphics.FillPie(new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);

                                                                                                                         // Draw a cubic bezier using a 2-pixel-wide red pen.
                                                                                                                         graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                                                                                                                             new Aspose.Imaging.Point(0, 0),
                                                                                                                             new Aspose.Imaging.Point(200, 133),
                                                                                                                             new Aspose.Imaging.Point(400, 166),
                                                                                                                             new Aspose.Imaging.Point(600, 400));

                                                                                                                         // Draw a raster image of the specified size at the specified location.
                                                                                                                         // The image is scaled to fit the desired rectangle.
                                                                                                                         using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
                                                                                                                         {
                                                                                                                             graphics.DrawImage(imageToDraw,
                                                                                                                                 new Aspose.Imaging.Rectangle(400, 200, 100, 50),
                                                                                                                                 new Aspose.Imaging.Rectangle(0, 0, deviceWidth, deviceHeight),
                                                                                                                                 Aspose.Imaging.GraphicsUnit.Pixel);
                                                                                                                         }

                                                                                                                         // Draw a text string
                                                                                                                         graphics.DrawString("Hello World!", new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), Aspose.Imaging.Color.DarkRed, 200, 300);

                                                                                                                         // Create a path to fill
                                                                                                                         Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
                                                                                                                         figureToFill.IsClosed = true;

                                                                                                                         Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
                                                                                                                         pathToFill.AddFigure(figureToFill);

                                                                                                                         figureToFill.AddShapes(new Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
                                                                                                                                 new Aspose.Imaging.Shapes.BezierShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 200),
                                                                                                                                         new Aspose.Imaging.PointF(400, 200),
                                                                                                                                         new Aspose.Imaging.PointF(500, 100),
                                                                                                                                         new Aspose.Imaging.PointF(600, 200),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.PolygonShape(
                                                                                                                                     new Aspose.Imaging.PointF[]
                                                                                                                                     {
                                                                                                                                         new Aspose.Imaging.PointF(300, 100),
                                                                                                                                     }),
                                                                                                                                 new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
                                                                                                                             });

                                                                                                                         // Fill the path using a yellow brush and a green pen to draw outline
                                                                                                                         graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);

                                                                                                                         // Create a path to draw
                                                                                                                         Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
                                                                                                                         Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
                                                                                                                         pathToDraw.AddFigure(figureToDraw);

                                                                                                                         figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
                                                                                                                             {
                                                                                                                                 new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
                                                                                                                             });

                                                                                                                         // Draw the path using a 5-pixel-wide orange pen.
                                                                                                                         graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);

                                                                                                                         // In order to rasterize SVG we need to specify rasterization options.
                                                                                                                         Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                                         Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                                         saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                                         // Get the final WMF image which includes all drawing commands
                                                                                                                         using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = graphics.EndRecording())
                                                                                                                         {
                                                                                                                             emfImage.Save(dir + "test.output.emf");
                                                                                                                         }

GetTransform()

Die Welt verwandelt sich.

public Matrix GetTransform()

Returns

Matrix

Die Transformation der Matrix.

IntersectClip(RectangleF)

Aktualisieren Sie die Clip-Region dieser Grafik auf die Kreuzung der aktuellen Clip-Region und die angegebenen Rectangle-Struktur.

public void IntersectClip(RectangleF rect)

Parameters

rect RectangleF

Rectangle Struktur, um mit der aktuellen Clip-Region zu intersect.

IntersectClip(Region)

Aktualisieren Sie die Clip-Region dieser Grafiken auf die Kreuzung der aktuellen Clip-Region und der angegebenen Region.

public void IntersectClip(Region region)

Parameters

region Region

Die Region muss mit der aktuellen Region miteinander verbunden sein.

MultiplyTransform(Matrix)

Multipliziert die Transformation der Welt dieser Grafik und spezifiziert die Matrix.

public void MultiplyTransform(Matrix matrix)

Parameters

matrix Matrix

Die Matrix, die die Transformation der Welt multipliziert.

MultiplyTransform(Matrix und MatrixOrder)

Multipliziert die Welttransformation dieser Grafik und spezifiziert die Matrix in der angegebenen Reihenfolge.

public void MultiplyTransform(Matrix matrix, MatrixOrder order)

Parameters

matrix Matrix

Die Matrix, die die Transformation der Welt multipliziert.

order MatrixOrder

Die Ordnung der Vervielfältigung.

ResetClip()

Wiederherstellen des Clip.

public void ResetClip()

RotateTransform(Flotte)

Anwendung der angegebenen Rotation auf die Transformationsmatrix dieser Grafik.

public void RotateTransform(float angle)

Parameters

angle float

Winkel der Rotation in Grad.

RotateTransform(Flöte, PointF, MatrixOrder)

Anwendung der angegebenen Rotation auf die Transformationsmatrix dieser Grafik in der angegebenen Reihenfolge.

public void RotateTransform(float angle, PointF center, MatrixOrder order)

Parameters

angle float

Winkel der Rotation in Grad.

center PointF

Das Rotationszentrum.

order MatrixOrder

Erläutert, ob die Rotation an die Matrix-Transformation angepasst oder verhängt wird..

ScaleTransform(Flotte und Flotte)

Anwenden Sie die angegebenen Skalierungsfunktion auf die Transformationsmatrix dieser Grafik, indem Sie sie auf die Transformationsmatrix des Objekts abhängen.

public void ScaleTransform(float sx, float sy)

Parameters

sx float

Scale Factor in der Richtung x.

sy float

Scale Factor in der Richtung Y.

ScaleTransform(Flotte, Flotte und MatrixOrder)

Anwendung der angegebenen Skalierungsfunktion auf die Transformationsmatrix dieser Grafik in der angegebenen Reihenfolge.

public void ScaleTransform(float sx, float sy, MatrixOrder order)

Parameters

sx float

Scale Factor in der Richtung x.

sy float

Scale Factor in der Richtung Y.

order MatrixOrder

Erläutert, ob die Skalierungsoperation an die Transformationsmatrix geprägt oder angeschlossen ist.

SetTransform(Matrix)

Setzen Sie die Transformation.

public void SetTransform(Matrix transform)

Parameters

transform Matrix

Die neue Transformation Matrix.

Examples

Dieses Beispiel zeigt, wie man ein EMF-Bild aus einem Datei laden und einen Textstreifen über ihn drücken kann.

string dir = "c:\\temp\\";

                                                                                                 using (Aspose.Imaging.FileFormats.Emf.EmfImage emfImage = (Aspose.Imaging.FileFormats.Emf.EmfImage)Aspose.Imaging.Image.Load(dir + "test.emf"))
                                                                                                 {
                                                                                                     Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D graphics =
                                                                                                         Aspose.Imaging.FileFormats.Emf.Graphics.EmfRecorderGraphics2D.FromEmfImage(emfImage);

                                                                                                     // First, get the image size
                                                                                                     int width = emfImage.Width;
                                                                                                     int height = emfImage.Height;

                                                                                                     // Second, calculate a transformation to put a text string along the main diagonal of the image -
                                                                                                     // from the upper-left to the bootom-right corner.
                                                                                                     float emFontSize = 96f;
                                                                                                     float d = (float)System.Math.Sqrt(width * width + height * height);
                                                                                                     float scaleFactor = d / (emFontSize * 5f);

                                                                                                     float tan = ((float)height) / width;                
                                                                                                     double radians = System.Math.Atan(tan);
                                                                                                     double degrees = (180 * radians) / System.Math.PI;

                                                                                                     Aspose.Imaging.Matrix transform = new Aspose.Imaging.Matrix();
                                                                                                     transform.Rotate((float)degrees);
                                                                                                     transform.Scale(scaleFactor, scaleFactor);

                                                                                                     // Then, set the transform.
                                                                                                     graphics.SetTransform(transform);

                                                                                                     // Finally, put a watermark (text string of pink color) along the main diagonal.
                                                                                                     graphics.DrawString("WATERMARK", new Aspose.Imaging.Font("Courier New", emFontSize), Aspose.Imaging.Color.LightPink, 0, 0/*, (float)degrees*/);

                                                                                                     // Save the image with watermark to another EMF file.
                                                                                                     using (Aspose.Imaging.FileFormats.Emf.EmfImage scaledEmfImage = graphics.EndRecording())
                                                                                                     {
                                                                                                         scaledEmfImage.Save(dir + "test.scaled.emf");
                                                                                                     }
                                                                                                 }

TranslateTransform(Flotte und Flotte)

ndert die Herkunft des Koordinatsystems, indem die angegebenen Übersetzung auf die Transformationsmatrix dieser Grafik abhängt.

public void TranslateTransform(float x, float y)

Parameters

x float

Die X-Koordinate der Übersetzung.

y float

Der Y-Koordinat der Übersetzung.

TranslateTransform(Flotte, Flotte und MatrixOrder)

ndert die Herkunft des Koordinatsystems durch Anwendung der angegebenen Übersetzung auf die Transformationsmatrix dieser Grafik in der angegebenen Reihenfolge.

public void TranslateTransform(float x, float y, MatrixOrder order)

Parameters

x float

Die X-Koordinate der Übersetzung.

y float

Der Y-Koordinat der Übersetzung.

order MatrixOrder

Erläutert, ob die Übersetzung an die Transformationsmatrix geprägt oder angeschlossen ist.

 Deutsch