0

我想将图片框控件和标签显示到特定记录的列表视图中。所有的记录都来自数据库。我试过了,但我只能显示单个图像,但我想显示所有带有标签的图像我尝试的代码是

DataSet ds3 = load.LoadNewlyAddedBook();
        DataTable dt3 = ds3.Tables[0];
        lstViewNewAdd.Items.Clear();
        int count = dt3.Rows.Count;
        for (int a = 0; a < count; a++)
        {
            DataRow dtRow = dt3.Rows[a];
            if (dtRow.RowState != DataRowState.Deleted)
            {
                ListViewItem lvi3 = new ListViewItem(dtRow["BookName"].ToString());
                PictureBox p1 = new PictureBox();
                p1.Size = new Size(80, 100);
                Byte[] bytes = (Byte[])(dtRow["BookImage"]);
                MemoryStream ms = new MemoryStream(bytes);
                p1.Image = Image.FromStream(ms);
                p1.SizeMode = PictureBoxSizeMode.StretchImage;
                Label lbl = new Label();
                lbl.Text = dtRow["BookName"].ToString();
                lstViewNewAdd.Controls.Add(p1);
                //lstViewNewAdd.Controls.Add(lbl);
                //lvi3.SubItems.Add(p1);

                //lstViewNewAdd.Items.Add(lvi3);
            }
        }

请建议我任何解决方案。提前致谢。

4