private void FormTemplatePreview_Load(object sender, EventArgs e) { this.textBoxReviewTitle.Text = this.Title.Trim(); this.webBrowser1.Url = new Uri(WriteHtmlToPath()); } //将html代码写入临时文件夹下面的 然后发来给webbrowser使用 private string WriteHtmlToPath() { string tempPath = System.IO.Path.GetTempPath(); string htmlPath = Path.Combine(tempPath, @"tempReview.html"); if (!File.Exists(htmlPath)) { File.Create(htmlPath); } File.WriteAllText(htmlPath, this.Content); return htmlPath; }