Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在列表视图中显示图像?_C# - Fatal编程技术网

C# 如何在列表视图中显示图像?

C# 如何在列表视图中显示图像?,c#,C#,我的知识存储在sql server中,例如列表视图中的数据示例如下所示,我写道: item.SubItems.Add(dr["Fname"].ToString ()); 当我在字段列表中时,单击文本框时,我编写的一条语句显示为Vaio示例: Vfname.Text = e.Item.SubItems[1].Text; 现在还不清楚您想做什么,但我认为您应该使用System.Drawing.Image.FromFile()将图像对象添加到列表视图中,然后调用Graphics.DrawImage

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

item.SubItems.Add(dr["Fname"].ToString ());
当我在字段列表中时,单击文本框时,我编写的一条语句显示为Vaio示例:

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

现在还不清楚您想做什么,但我认为您应该使用System.Drawing.Image.FromFile()将图像对象添加到列表视图中,然后调用Graphics.DrawImage将它们绘制出来,并传递列表视图中的图像文件


请提供更多信息,说明您迄今为止所做的尝试以及您希望实现的目标-从您的描述中,我真的无法理解您做了什么和什么不起作用,这非常令人困惑。
   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);