for (int i = 0; i < photos.Count; ++i)
{
var photo = photos[i];
var pic = new PictureBox() { ImageLocation = photo.ThumbnailUrl, BorderStyle = BorderStyle.FixedSingle, SizeMode = PictureBoxSizeMode.AutoSize, Tag = photo };
container.Controls.Add(pic);
pic.Click += (sender, e) =>
{
photo = (sender as PictureBox).Tag as FlickrNet.Photo;
var sizes = m_Flickr.PhotosGetSizes(photo.PhotoId);
var hasLargePhoto = (from item in sizes
where string.Equals(item.Label, "Large", StringComparison.CurrentCultureIgnoreCase)
select item).Count() > 0;
var dialog = new Form();
var photoBox = new PictureBox() { ImageLocation = hasLargePhoto ? photo.LargeUrl : photo.MediumUrl, Dock = DockStyle.Fill };
dialog.Controls.Add(photoBox);
dialog.ShowDialog();
};
}
form.Controls.Add(container);
form.ShowDialog();
}</pre>