Arkadaşlar merhaba
private void Kitaplar_Load(object sender, System.EventArgs e)
{
int pBoxX, pBoxY;
pBoxX = 10;
pBoxY = 20;
string[] pdfs = Directory.GetFiles("Pdf","*.pdf",SearchOption.AllDirectories);
string[] images = Directory.GetFiles("KitapResimleri");
for (int i = 0;i<images.Length;i++)
{
PictureBox pBox = new PictureBox();
pBox.Name = "images" + i;
pBox.Image = Image.FromFile(images[i]);
pBox.Width = 219;
pBox.Height = 245;
pBox.SizeMode = PictureBoxSizeMode.StretchImage;
pBox.Location = new Point(pBoxX, pBoxY);
pBox.Tag = "0";
if (i == 3)
{
pBoxX = 14;
pBoxY += 293;
}
else
{
pBoxX += 285;
}
gBoxKitaplar.Controls.Add(pBox);
}
}
private string PathYol(string path)
{
PdfOkuma pdfOku = new PdfOkuma(path);
pdfOku.ShowDialog();
return path;
}
Kodumda,dışarıdan gelen resmin boyutuna göre otomatik olarak picturebox oluşturup resimleri,pictureboxa yerleştiriyorum
Bunların hepsi runtimede oluşuyor
Takıldığım konu şu;
Her picturebox’a farklı name verdim
Fakat istediğim olay şu;
Runtimede gelen resimlerle şöyle bir ekran oluşturuyorum;
Burda belki komik olabilir ama mesela atıyorum ilk resme tıkladığımda ona bağlı olan pdf dosyasını açmasını isteyeceğim
Ama click olayını nasıl yapacağımı gerçekten bilmiyorum
çünkü bunlar runtimede oluşturuyor
umarım derdımı anlatabilmişimdir