在C# 窗体中,我已经成功做出使用button按钮和imagelist控件然后选择本机图片,然后在listview上面显示的小图片,但是我现在需要完成的是点击listview上面的小图 然后在picturebox控件上面显示大图:代码如下:
private void listView2_ItemActivate(object sender, EventArgs e)
        {
            pictureBox1.Image = listView1.SelectedItems[0].ImageList.Images[0];
        }
但是问题是这么显示的是将小图拉伸成了大图 看不清楚啊, 将本机图片插入到listview里面(小图)代码如下:
private Image brower_pic2()
        {
            OpenFileDialog mydlgview = new OpenFileDialog();
            mydlgview.Title = "选择图片";
            mydlgview.Filter = "jpeg图像文件(*.jpg)|*.jpg|所有图像文件(jpeg,gif,bmp,etc)|*.jpg;*.jpeg;*.gif;*.bmp|所有文件(*.*)|*.*";
            string mydestpath = "";
            
            if (mydlgview.ShowDialog() == DialogResult.OK)
            {
                srcpath = mydlgview.FileName;
                string myguid = System.Guid.NewGuid().ToString().ToUpper();//这句是否可以不要;
                string myextname = System.IO.Path.GetExtension(mydlgview.FileName);
                string myphotofile = myguid + myextname;
                mydestpath = Application.StartupPath + myphotofile;
               System.IO.File.Copy(srcpath, mydestpath);
                //pictureBox1.Image = new Bitmap(mydestpath);
            }
            Bitmap bm = new Bitmap(mydestpath);
            return bm;
        }