2013-03-28 326 views
-3

我正在使用Aforge.net示例,我想获取放置在资源上的图像的名称。我无法这样做,因为image.tag发生错误。如何获取图像的名称

请帮

+2

什么错误? – Sherlock 2013-03-28 11:32:17

+0

试试这个http://forums.asp.net/t/1774226.aspx/1 – Mogli 2013-03-28 11:35:15

+1

@Sherlock你不能帮忙。我们在这里需要通灵,而不是侦探;) – 2013-03-28 11:35:52

回答

0

您可以使用URI类加载路径和细分集合拉形象的名字:

Uri uri = new Uri("http://www.XXXX.com/imageName.jpg"); 
string fileName = uri.Segments.Last(); 

编辑

让我们看到这样的答案:如果你喜欢它?

C# how to get a bitmap from a picturebox

Get bitmap file name

新的编辑

System.IO.FileInfo info = new System.IO.FileInfo(Properties.Resources.Stop); 
string fileName = info.Name; 
+0

我有一个名为stop.png的图像。我已经将此图像加载到resourceBitmap img1 = new Bitmap(Properties.Resources.Stop);我想获得图像的名称,即我想要停止这是否有意义? – 2013-03-28 11:41:49

+0

请参阅我的编辑答案 – 2013-03-28 12:00:43

+0

感谢您的回复。上面给出的链接显示如何更改图像文件的名称。我想在文本框或标签中显示图像文件的名称 – 2013-03-28 12:07:28