我使用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;