将html代码写入临时文件夹下面的 然后发来给webbrowser使用

        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;
        }

 

posted @ 2012-12-14 09:51  麦田HH  阅读(275)  评论(0编辑  收藏  举报