リストからピクチャボックスに画像を表示したい。私の画像は画像ボックスに表示されていますが、問題は、リストで定義されている画像ボックスの画像のサイズを示していることです。画像サイズを大きくする方法を誰か教えてください。
ここに私のコードがあります:
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);
}
}