Karekterleri Picturebox'da gösterme

scallywag
03-05-2010, 15:54   |  #1  
OP Yıllanmış Üye
Teşekkür Sayısı: 0
379 mesaj
Kayıt Tarihi:Kayıt: Ara 2007

Captcha mantığında olduğu gibi rassal oluşturmuş olduğum karekterleri picturebox'da göstermek istiyorum nasıl yapabilirim? Teşekkürler

scallywag
18-05-2010, 00:31   |  #2  
OP Yıllanmış Üye
Teşekkür Sayısı: 0
379 mesaj
Kayıt Tarihi:Kayıt: Ara 2007

Ben sordun ben cevaplıyım bari

[ Tüm kodu seç ] [ Yeni Pencerede Göster ]
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