C#中有一个窗体form1中分别有控件:button1(浏览图片)、picturebox1(显示浏览选中的图片)、button2(插入图片)、listview1(显示图片缩略图控件)就是点击button1后在本机选择好图片先显示在picturebox1中,然后点击button2将图片的缩略图显示在listview1中,依次可以添加多张图片,然后增添button3(保存图片到SQL数据表中),点击button3后就将所浏览添加到listview1中的图片都添加在SQL数据库中,相反点击button4(将数据库中图片加载到listview1中),现在问题如下:当listview1显示刚刚保存在数据库中的图片后,我要在listview1中删除一张图片,或者是更换其中一张图片,然后在保存到数据库中,如何实现啊: 下面是关键代码:
private void Addpictoimagelist() //将浏览的图片保存到listview中
        {
                        Bitmap bm = new Bitmap(srcpath);
            imageList1.Images.Add(bm);
           ListViewItem item1 = new ListViewItem(picdetails.Text, imageList1.Images.Count -1)                 listView1.Items.Add(item1);
            str_word.Add(picdetails.Text);
            listView1.SmallImageList = imageList1;
            str_srcpath.Add(srcpath);
         }
 private void addpictotable(string str_path, string pic_ziduan, string word_ziduan, string array_word)//添加listview1中图片到数据库中
        {
            FileStream fs = new FileStream(str_path, FileMode.Open, FileAccess.Read);
            byte[] imgbytesin = new byte[fs.Length];
            fs.Read(imgbytesin, 0, Convert.ToInt32(fs.Length));
            fs.Close();
            string str_insertpic = "update picsave set " + pic_ziduan + "= @imgfile," + word_ziduan + "=@wordfile where 零件号='" + CMB_LJNUM.Text + "' and 生产日期='" + DateTime.Parse(DTPMPOneTime.Text) + "' and 序号='" + TBNumID.Text + "' and 班次='"+cmbDN.Text+"'";
            SqlCommand str_sc = new SqlCommand(str_insertpic, operdb.sqlconnect());
            str_sc.Connection.Open();
            str_sc.Parameters.Add("@imgfile", SqlDbType.Binary).Value = imgbytesin;
            str_sc.Parameters.Add("@wordfile", SqlDbType.NVarChar, 15).Value = array_word;
            str_sc.ExecuteNonQuery();
            str_sc.Connection.Close();
        }
public Bitmap showpic(string sqldr,string str_piczd) //将数据库中图片加载到listview中
        {
            try
            {
                byte[] imagebytes = null;
                SqlDataReader dr = operdb.DataReader(sqldr);
                dr.Read();
                imagebytes = (byte[])dr[str_piczd];
                MemoryStream ms = new MemoryStream(imagebytes);
                Bitmap bmpt = new Bitmap(ms);
                dr.Close();
                return bmpt;
            }
            catch
            {              
                return null;
            }
        }