Brush that determines the color and texture of the drawn text.
point
PointF
PointF structure that specifies the upper-left corner of the drawn text.
Exceptions
exception
condition
ArgumentNullException
brush is null. -or- s is null.
Examples
This example uses Graphics class to create primitive shapes on the Image surface. To demonstrate the operation, the example creates a new Image in PNG format and draw primitive shapes on Image surface using Draw methods exposed by Graphics class
[C#]//Creates an instance of FileStreamusing(System.IO.FileStreamstream=newSystem.IO.FileStream(@"C:\temp\output.png",System.IO.FileMode.Create)){//Create an instance of PngOptions and set its various propertiesAspose.Imaging.ImageOptions.PngOptionspngOptions=newAspose.Imaging.ImageOptions.PngOptions();//Set the Source for PngOptionspngOptions.Source=newAspose.Imaging.Sources.StreamSource(stream);//Create an instance of Image using(Aspose.Imaging.Imageimage=Aspose.Imaging.Image.Create(pngOptions,500,500)){//Create and initialize an instance of Graphics classAspose.Imaging.Graphicsgraphics=newAspose.Imaging.Graphics(image);//Clear Graphics surfacegraphics.Clear(Aspose.Imaging.Color.Wheat);//Draw an Arc by specifying the Pen object having Black color, //a Rectangle surrounding the Arc, Start Angle and Sweep Anglegraphics.DrawArc(newAspose.Imaging.Pen(Aspose.Imaging.Color.Black,2),newAspose.Imaging.Rectangle(200,200,100,200),0,300);//Draw a Bezier by specifying the Pen object having Blue color and co-ordinate Points.graphics.DrawBezier(newAspose.Imaging.Pen(Aspose.Imaging.Color.Blue,2),newAspose.Imaging.Point(250,100),newAspose.Imaging.Point(300,30),newAspose.Imaging.Point(450,100),newAspose.Imaging.Point(235,25));//Draw a Curve by specifying the Pen object having Green color and an array of Pointsgraphics.DrawCurve(newAspose.Imaging.Pen(Aspose.Imaging.Color.Green,2),new[]{newAspose.Imaging.Point(100,200),newAspose.Imaging.Point(100,350),newAspose.Imaging.Point(200,450)});//Draw an Ellipse using the Pen object and a surrounding Rectanglegraphics.DrawEllipse(newAspose.Imaging.Pen(Aspose.Imaging.Color.Yellow,2),newAspose.Imaging.Rectangle(300,300,100,100));//Draw a Line graphics.DrawLine(newAspose.Imaging.Pen(Aspose.Imaging.Color.Violet,2),newAspose.Imaging.Point(100,100),newAspose.Imaging.Point(200,200));//Draw a Pie segmentgraphics.DrawPie(newAspose.Imaging.Pen(Aspose.Imaging.Color.Silver,2),newAspose.Imaging.Rectangle(newAspose.Imaging.Point(200,20),newAspose.Imaging.Size(200,200)),0,45);//Draw a Polygon by specifying the Pen object having Red color and an array of Pointsgraphics.DrawPolygon(newAspose.Imaging.Pen(Aspose.Imaging.Color.Red,2),new[]{newAspose.Imaging.Point(20,100),newAspose.Imaging.Point(20,200),newAspose.Imaging.Point(220,20)});//Draw a Rectanglegraphics.DrawRectangle(newAspose.Imaging.Pen(Aspose.Imaging.Color.Orange,2),newAspose.Imaging.Rectangle(newAspose.Imaging.Point(250,250),newAspose.Imaging.Size(100,100)));//Create a SolidBrush object and set its various propertiesAspose.Imaging.Brushes.SolidBrushbrush=newAspose.Imaging.Brushes.SolidBrush();brush.Color=Color.Purple;brush.Opacity=100;//Draw a String using the SolidBrush object and Font, at specific Pointgraphics.DrawString("This image is created by Aspose.Imaging API",newAspose.Imaging.Font("Times New Roman",16),brush,newAspose.Imaging.PointF(50,400));// save all changes.image.Save();}}
Draws the specified text string at the specified location with the specified Brush and Font objects using the formatting attributes of the specified StringFormat.
Draws the specified text string at the specified location with the specified Brush and Font objects using the formatting attributes of the specified StringFormat.
Draws the specified text string in the specified rectangle with the specified Brush and Font objects using the formatting attributes of the specified StringFormat.