OP Yıllanmış Üye
379 mesaj
Kayıt Tarihi:Kayıt: Ara 2007
Ben sordun ben cevaplıyım bari
string _securityKey; private void DrawBox()
{
_securityKey = GetRandomText(3);
Image _im = new Bitmap(pictureBox1.Width, pictureBox1.Height);
Graphics _g = Graphics.FromImage(_im);
PrivateFontCollection _pfc = new PrivateFontCollection();
_pfc.AddFontFile("C:\\latin.ttf");//yazı fontu
_g.Clear(Color.FromArgb(0, 0xff, 0xff, 0xff));
_g.DrawString(_securityKey,
new Font(_pfc.Families[0], 24F),
Brushes.WhiteSmoke,
new PointF(0, 0));
pictureBox1.Image = _im;
}
private string GetRandomText(int Length)//rastsal karekter fonksiyonu
{
string _result = string.Empty;
string alpha = "AzByCxDwEvFuGtHsIrJqKpLoMnNmOlPkQjRiShTgUfVeWdXcYbZa1234567890";
Random r = new Random();
for (int i = 0; i < Length; i++)
_result += alpha.Substring(r.Next(alpha.Length), 1);
return _result;
}
Son Düzenleme: scallywag ~ 18 Mayıs 2010 00:32