İstanbul

İstanbul

13 Mart 2015 Cuma

PictureBox 'a resim eklemek

Formumuza 1 adet PictureBox ekliyoruz.
Hemen altına 1 adet button ekliyoruz ve evets'ine aşağıdaki kodları yazıyoruz


 private void btnEkle_Click(object sender, EventArgs e)
        {
OpenFileDialog fd = new OpenFileDialog ();
            fd.Title = "Resim Aç";
            fd.Filter = "Jpeg Dosyası (*.jpg)|*.jpg|Gif Dosyası (*.gif)|*.gif|Png Dosyası (*.png)|*.png|Tif Dosyası (*.tif)|*.tif";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Image = Image.FromFile(fd.FileName);
                resimPath = fd.FileName.ToString();
            }
        }

Hiç yorum yok:

Yorum Gönder