2017-09-13 40 views
0

我想更改應用程序任務欄和快捷方式圖標。用戶希望在運行時需要靈活性來更改圖標。如何更改任務欄和快捷方式圖標的運行時間?

this.Icon =new Icon("Images/A.ico");

它會在運行時只改變窗口標題圖標。請建議如何以編程方式實現。

感謝, 馬亨德拉

+0

你的意思是,要更改桌面快捷方式的圖標? – Znaneswar

+0

是桌面快捷方式和任務欄以及 – mahen

回答

0

這可能是有益的,爲您打造deesktop快捷

的完整代碼here

using System.IO; 
//...// 

private void appShortcutToDesktop(string linkName) 
{ 
    string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); 

    using (StreamWriter writer = new StreamWriter(deskDir + "\\" + linkName + ".url")) 
    { 
    string app = System.Reflection.Assembly.GetExecutingAssembly().Location; 
    writer.WriteLine("[InternetShortcut]"); 
    writer.WriteLine("URL=file:///" + app); 
    writer.WriteLine("IconIndex=0"); 
    string icon = app.Replace('\\', '/'); 
    writer.WriteLine("IconFile=" + icon); 
    writer.Flush(); 
} 
} 
+0

感謝reply.It只是創建桌面快捷方式,它不能夠改變桌面快捷方式圖標。在上面的函數中設置圖標路徑的位置? – mahen

相關問題