一、問題描述
欲將程式最終的結果報告顯示出來,發現若以現有的程式畫面來做輸出並不是很理想;
想改以另出來至一網頁檔來呈現。
輸出至一網頁檔後,想一同透過原先的程式界面直接開起此htm檔案,
方便使用者直接瀏覽。
二、方法
一般而言,直接在C#中想開啟外部網頁的方式:
System.Diagnostics.Process.Start("iexplore.exe", "http://google.com");
若想開啟的檔案為內部網頁,則其路徑需指定正確才能如期執行:
string filename = "file:///" + Environment.CurrentDirectory + @"\nctu.htm";
System.Diagnostics.Process.Start("iexplore.exe", filename);
using (System.Diagnostics.Process p = new System.Diagnostics.Process())
{
p.StartInfo.FileName = filename;
p.Start();
}
文章標籤
全站熱搜
留言列表