close

image


image


image


image


image


image



image


image


image


image


image


image


image


image


image


image


   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: }


image







參考資料

1. https://youtu.be/3R9HsqwiiQI

arrow
arrow
    全站熱搜

    me1237guy 發表在 痞客邦 留言(0) 人氣()