ユーザーが選択したフォルダの画像を表示しようとしています。画像のないレコードを選択すると、次のような画像が表示されます。
Empty.png
これが私が書いたコードです。説明に書いたものに合うように変更するにはどうすればよいですか?(この質問の上部)
string[] fileEntries = Directory.GetFiles(@"C:\Projects_2012\Project_Noam\Files\ProteinPic");
foreach (string fileName in fileEntries)
{
if (fileName.Contains(comboBox1.SelectedItem.ToString()))
{
Image image = Image.FromFile(fileName);
// Set the PictureBox image property to this image.
// ... Then, adjust its height and width properties.
pictureBox1.Image = image;
pictureBox1.Height = image.Height;
pictureBox1.Width = image.Width;
}
}