منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : توليد أيقونة من نص
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
كاتب الموضوع : Boutemine Oualid

السلام عليكم و رحمة الله و بركاته

فيبي .نت

كود :
Function CreateIcon(string s) As Icon
Dim bmp As New Bitmap(16, 16)
Dim brush As New SolidBrush(Color.Black)
Dim g As Graphics = Graphics.FromImage(bmp)
g.DrawString(s, New Font("Arial", 10f), brush, 0, 0)
g.Dispose()

Dim hIcon As IntPtr = bmp.GetHicon()
Return Icon.FromHandle(hIcon)
End Function
سي شارب

كود :
public static Icon CreateIcon(string s)
{
Bitmap bmp = new Bitmap(16, 16);
SolidBrush brush = new SolidBrush(Color.Black);
Graphics g = Graphics.FromImage(bmp);
g.DrawString(s, new Font("Arial", 10f), brush, 0, 0);
g.Dispose();
IntPtr hIcon = bmp.GetHicon();
return Icon.FromHandle(hIcon);
}