📜  c#加载嵌入的html文档并在浏览器中显示 - Html代码示例

📅  最后修改于: 2022-03-11 14:53:29.750000             🧑  作者: Mango

代码示例1
1. Add HTML Page from C3 Add New Item
2. Put html inside
3. Drag and drop the html (e.g. HTMLPage1.html) file into your Resources tab in the project:
4. Use code below 
        private void button1_Click_1(object sender, EventArgs e)
        {
            string html = Properties.Resources.HTMLPage1;
            string tmpFileName = Path.ChangeExtension(Path.GetTempFileName(), ".html");
            using (StreamWriter sw = File.CreateText(tmpFileName))
            {             
                sw.Write(html);
                sw.Flush();
            }
            if (File.Exists(tmpFileName))
                Process.Start(tmpFileName);
        }