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);
}
}
我做到了。但仍然有問題。圖片中的圖片不清晰。請看我編輯的問題。 –