2013-03-28 249 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

相關問題