private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listBox1.SelectedIndex;
            int ID = Image[index].ID;
            string Filename = Image[index].Filename;
            string Category = Image[index].Category;
            string Tags = Image[index].Tags;
            string Comments = Image[index].Comments;            textBoxID.Text = Convert.ToString(ID);
            textBoxFilename.Text = Convert.ToString(Filename);
            comboBoxCategory.Text = Convert.ToString(Category);
            textBoxTags.Text = Convert.ToString(Tags);
            textBoxComments.Text = Convert.ToString(Comments);
上面的代码是我自己打的,可以实现点击listbox列表里的图片filename时,分别显示它们的category,tags,comments,和ID但我不知道该怎么才能实现在picturebox里出现选中的图片,请教各位了,万分感谢

解决方案 »

  1.   

    把选中的图片和路径赋值给picturebox.Image就可以显示了
      

  2.   

    Image image = Image.FromFile("xxx");
    picturebox1.Image = image;
      

  3.   

    谢谢,但不知为什么“FromFile”有红线,下面是错误原因,请问怎么办?谢谢Error 1 'System.Collections.Generic.List<ImageOrganiser.Form1.detail>' does not contain a definition for 'FromFile' and no extension method 'FromFile' accepting a first argument of type 'System.Collections.Generic.List<ImageOrganiser.Form1.detail>' could be found (are you missing a using directive or an assembly reference?) F:\ImageOrganiser-2012\ImageOrganiser\Form1.cs 278 33 ImageOrganiser