当前位置:编程学习 > C#/ASP.NET >>

关于如果预览图片的问题

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里出现选中的图片,请教各位了,万分感谢 --------------------编程问答-------------------- 把选中的图片和路径赋值给picturebox.Image就可以显示了 --------------------编程问答--------------------
引用 1 楼  的回复:
把选中的图片和路径赋值给picturebox.Image就可以显示了


谢谢哥
能不能再详细点呢 我不知道怎么赋予选中图片路径 --------------------编程问答-------------------- Image image = Image.FromFile("xxx");
picturebox1.Image = image; --------------------编程问答--------------------
引用 3 楼  的回复:
Image image = Image.FromFile("xxx");
picturebox1.Image = image;

谢谢,但不知为什么“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
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,