如何在列表视图中显示图像

本文关键字:显示 显示图 图像 视图 列表 | 更新日期: 2023-09-27 18:13:48

我的知识存储在sql server中,例如列表视图中的数据示例如下,我写道:

item.SubItems.Add(dr["Fname"].ToString ());

我在字段列表上写的一个语句,点击文本框就会显示Vaio示例:

Vfname.Text = e.Item.SubItems[1].Text;

如何在列表视图中显示图像

这是不清楚你要做什么,但我认为你应该添加图像对象到您的列表视图,使用System.Drawing.Image.FromFile(),然后绘制他们调用图形。DrawImage,传递你在listview中的图像文件

http://msdn.microsoft.com/en-us/library/42807xh1 (v = vs.110) . aspx

   Image newImage = Image.FromFile("SampImag.jpg");
    // Create Point for upper-left corner of image.
    Point ulCorner = new Point(100, 100);
    // Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner);