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;
}
Ancak bu kodun oluşturduğu metin "düz" boyutsuzdur ve altındaki gölge değildir. Benim koduyla aynı stil oluşturmak için yapabileceğim bir şeyBir resmin üzerinde kelimeler altında gölge nasıl oluşturulur?
var mı:
Bu istediğim yazı tarzı mı?
SiteMapPath veya ResolveURL nesnelerini, göreli yolu fiziksel olana aktarmak için nasıl kullanacağını bilen var mı? cheers,
[Gölge] (http://msdn.microsoft.com/en-us/library/xeawz664 (v = vs.80) .aspx) - gölge oluşturmak için Metin iki kez çizilir. İlk kez gri ve ofset. İkinci kez siyah. – adatapost
@AVD iyi bir fikir, şimdi deneyeceğim ve sonucu size bildiririm. – Franva
@AVD ancak yazı tipi stili nasıl yapılır? Cevabınız için – Franva