WinForms WebBrowser控件和图像相对路径错误

时间:2013-01-16 23:19:04

标签: c# winforms

我使用Winform Textbox编辑HTML片段,项目使用Winforms WebBrowser控件。如果我的HTML img标记的src属性使用相对路径,例如src="../cat_images/VOD/VOD_logo_small_2.jpg",则会转为src="about:../cat_images/VOD/VOD_logo_small_2.jpg"

如何摆脱about:

我应该只编写一个方法来过滤掉about:,还是WebBrowser控件中有一个可以用来禁用它的设置? WebBrowser控件还添加了一个额外的返回托架和换行符。有没有办法禁用它?

this.htmDisplay.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.chemicalMasterBindingSource, "CatalogDesc", true));
        this.htmDisplay.Fonts = new string[] {
    "Corbel",
    "Corbel, Verdana, Arial, Helvetica, sans-serif",
    "Georgia, Times New Roman, Times, serif",
    "Consolas, Courier New, Courier, monospace"};
        this.htmDisplay.IllegalPatterns = new string[] {
    "<script.*?>",
    "<\\w+\\s+.*?(j|java|vb|ecma)script:.*?>",
    "<\\w+(\\s+|\\s+.*?\\s+)on\\w+\\s*=.+?>",
    "</?input.*?>"};
        this.htmDisplay.Location = new System.Drawing.Point(92, 126);
        this.htmDisplay.Name = "htmDisplay";
        this.htmDisplay.Padding = new System.Windows.Forms.Padding(1);
        this.htmDisplay.ShowHtmlSource = true;
        this.htmDisplay.Size = new System.Drawing.Size(516, 245);
        this.htmDisplay.TabIndex = 149;
        this.htmDisplay.ToolbarStyle = GvS.Controls.ToolbarStyles.AlwaysInternal;                   

0 个答案:

没有答案