Created
July 17, 2015 16:34
-
-
Save bjoerntx/6e265fb16c0aafea23b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creates a new "DRAFT" sample image | |
private Bitmap CreateDraftImage() | |
{ | |
string sText = "DRAFT"; | |
Bitmap destination = new Bitmap(400, 400); | |
using (Graphics g = Graphics.FromImage(destination)) | |
{ | |
GraphicsUnit units = GraphicsUnit.Pixel; | |
g.Clear(Color.White); | |
StringFormat stringFormat = new StringFormat(); | |
stringFormat.Alignment = StringAlignment.Center; | |
stringFormat.LineAlignment = StringAlignment.Center; | |
g.DrawString(sText, new Font( | |
"Arial", | |
90, | |
FontStyle.Bold, | |
GraphicsUnit.Pixel), | |
new SolidBrush( | |
Color.FromArgb(64, Color.Black)), | |
destination.GetBounds(ref units), | |
stringFormat); | |
} | |
return destination; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment