Click or drag to resize

CanvasDrawText Method

Examples
Centered (C#)
// Load the image to work with.
AtalaImage image = new AtalaImage(@"D:\Test Images\1.jpg");

// Create a Canvas for this image.
Canvas canv = new Canvas(image);

// Setup the text font options.
Font fnt = new Font("Verdana", 36, FontStyle.Bold);

// Find out the rendered size of the text.
Size textSize = Canvas.CalculateTextSize("%%company%% DotImage", fnt);

// Draw the text centered on the image.
Point pt = new Point((image.Width - textSize.Width) / 2, (image.Height - textSize.Height) / 2);
canv.DrawText("%%company%% DotImage", pt, fnt, new SolidFill(Color.Red), new SolidFill(Color.Transparent));
CenteredVB (Visual Basic)
' Load the image to work with.
Dim image As AtalaImage =  New AtalaImage("D:\Test Images\1.jpg") 

' Create a Canvas for this image.
Dim canv As Canvas =  New Canvas(image) 

' Setup the text font options.
Dim fnt As Font =  New Font("Verdana", 36, FontStyle.Bold) 

' Find out the rendered size of the text.
Dim textSize As Size =  Canvas.CalculateTextSize("%%company%% DotImage", fnt) 

' Draw the text centered on the image.
Dim pt As Point =  New Point((image.Width - textSize.Width) / 2,(image.Height - textSize.Height) / 2) 
canv.DrawText("%%company%% DotImage", pt, fnt, New SolidFill(Color.Red), New SolidFill(Color.Transparent))
Overload List
  NameDescription
Public methodCode exampleDrawText(String, Point, Font, Fill)
Draw a single line text string onto this canvas specifying the upper left corner position.
Public methodDrawText(String, Rectangle, Font, Fill)
Draw multiline text onto this canvas specifying the rectangular bound area of the string.
Public methodDrawText(String, Point, Font, Fill, SolidFill)
Draw a single line text string onto this canvas specifying the upper left corner position and a solid background color.
Public methodDrawText(String, Point, Font, Fill, TextFormat)
Draw a single line text string onto this canvas specifying the upper left corner position and text formatting.
Public methodDrawText(String, Rectangle, Font, Fill, TextFormat)
Draw multiline text onto this canvas specifying the rectangular bound area of the string and text formatting.
Public methodDrawText(String, Point, Font, Fill, SolidFill, TextFormat)
Draw a single line text string onto this canvas specifying the upper left corner position and a solid background color.
Public methodDrawText(String, Rectangle, Font, Fill, SolidFill, TextFormat)
Draw a single line text string onto this canvas specifying the upper left corner position and a solid background color.
Top
Examples
Centered (C#)
// Load the image to work with.
AtalaImage image = new AtalaImage(@"D:\Test Images\1.jpg");

// Create a Canvas for this image.
Canvas canv = new Canvas(image);

// Setup the text font options.
Font fnt = new Font("Verdana", 36, FontStyle.Bold);

// Find out the rendered size of the text.
Size textSize = Canvas.CalculateTextSize("%%company%% DotImage", fnt);

// Draw the text centered on the image.
Point pt = new Point((image.Width - textSize.Width) / 2, (image.Height - textSize.Height) / 2);
canv.DrawText("%%company%% DotImage", pt, fnt, new SolidFill(Color.Red), new SolidFill(Color.Transparent));
CenteredVB (Visual Basic)
' Load the image to work with.
Dim image As AtalaImage =  New AtalaImage("D:\Test Images\1.jpg") 

' Create a Canvas for this image.
Dim canv As Canvas =  New Canvas(image) 

' Setup the text font options.
Dim fnt As Font =  New Font("Verdana", 36, FontStyle.Bold) 

' Find out the rendered size of the text.
Dim textSize As Size =  Canvas.CalculateTextSize("%%company%% DotImage", fnt) 

' Draw the text centered on the image.
Dim pt As Point =  New Point((image.Width - textSize.Width) / 2,(image.Height - textSize.Height) / 2) 
canv.DrawText("%%company%% DotImage", pt, fnt, New SolidFill(Color.Red), New SolidFill(Color.Transparent))
See Also