0
我想从列表显示图片到图片框。 我的图像在图片框中显示,但问题是它显示列表中定义的图片框中图片的大小。任何人都可以告诉我如何放大我的图像大小?从列表视图显示图像到图片框
这里是我的一段代码:
private void listView_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (ListViewItem itm in listView.SelectedItems)
{
int imgIndex = itm.ImageIndex;
if (imgIndex >= 0 && imgIndex < this.documents.Images.Count)
{
// this.documents.Images[imgIndex].Width = 417;
pictureBox.Image = this.documents.Images[imgIndex];
}
}
}
,这是我如何从数据库中获取的图像:
ImageList documents = new ImageList();
if (documents.Images.Count < 1)
{
MessageBox.Show("No Documents Found.");
}
else
{
// pictureBox.Image = documents.Images[1];
this.listView.View = View.LargeIcon;
documents.ImageSize = new Size(256, 256);
listView.LargeImageList = documents;
listView.Items.Clear();
for (int j = 0; j < documents.Images.Count; j++)
{
ListViewItem item = new ListViewItem();
item.ImageIndex = j;
this.listView.Items.Add(item);
}
}
我做到了。但仍然有问题。图片中的图片不清晰。请看我编辑的问题。 –