close
1: private void button1_Click(object sender, EventArgs e)
2: {
3: using (FolderBrowserDialog fbd = new FolderBrowserDialog())
4: {
5: if(fbd.ShowDialog() == DialogResult.OK)
6: {
7: Folder = fbd.SelectedPath;
8:
9: }
10: }
11: }
1: private void button2_Click(object sender, EventArgs e)
2: {
3: carEntities carEntities = new carEntities();
4: listBox1.Items.Clear();
5: foreach (Photo photo in carEntities.Photo)
6: {
7: listBox1.Items.Add(photo.Src);
8: }
9: }
1: private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
2: {
3: string filePath = $"{Folder}{listBox1.Text}";
4: if(File.Exists(filePath))
5: pictureBox1.Image = new Bitmap(filePath);
6: }
參考資料
全站熱搜
留言列表