KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
public static System.Drawing.Image GenerateGiftCard(String text, Font font, Color textColor) { System.Drawing.Image img = Bitmap.FromFile(@"G:\xxx\images\gift-card.jpg"); Graphics drawing = Graphics.FromImage(img); //measure the string to see how big the image needs to be SizeF textSize = drawing.MeasureString(text, font); //create a brush for the text Brush textBrush = new SolidBrush(textColor); float x, y; x = img.Width / 2 - textSize.Width / 2; y = img.Height / 2 - textSize.Height / 2; drawing.DrawString(text, font, textBrush, x, y); drawing.Save(); textBrush.Dispose(); drawing.Dispose(); return img; } But the text generated by this code is "plain" not dimensional and no shadow beneath it. This is the font style I want: Is there anything I can do to generate the same style via my code? Does anyone know how to use SiteMapPath or ResolveURL objects to transfer a relative path to a physical one? cheers,
Tags (comma-separated)
Save Edits
Cancel