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;
}
Pero el texto generado por este código es "simple", no dimensional y sin sombra debajo de él.Cómo generar sombra debajo de las palabras en una imagen
Este es el estilo de fuente Quiero:
¿Hay algo que pueda hacer para generar el mismo estilo a través de mi código?
¿Alguien sabe cómo usar los objetos SiteMapPath o ResolveURL para transferir una ruta relativa a una física? vivas,
[Shadow] (http://msdn.microsoft.com/en-us/library/xeawz664 (v = vs.80) .aspx) - Para crear la sombra , el texto se dibuja dos veces. La primera vez que está en gris y offset. La segunda vez es en negro. – adatapost
@AVD buena idea, lo intentaré ahora y le haré saber el resultado. – Franva
@AVD, pero ¿cómo hacer el estilo de fuente? – Franva