webbrowser visual basic 2010

时间:2016-01-24 21:20:42

标签: c# vb.net iframe

我在我的申请中添加了这些

  1. WebbRowser1
  2. 按钮
  3. 文本框
  4. 问题是,当我的应用加载时,它会从文本框加载iframe并将其显示在我的webbrowser上,但它在我的webbrowser上显示空格

    这是我的代码

    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1.DocumentText = TextBox1.Text
        End Sub
    End Class
    

    此处显示iframe和webbrowser之间的空格 enter image description here

1 个答案:

答案 0 :(得分:0)

尝试以下操作,使用以下内容我们在此处设置边距和填充为0。我通过将下面的html添加到项目资源

中来测试它
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="" X-UA-Compatible"" content="" IE="10" />
    <meta charset="utf-8" />
    <title></title>
</head>
<body style="margin:0; padding:0">
    <iframe src="http://www.w3schools.com"></iframe>
</body>
</html>

从资源

加载上述代码
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        WebBrowser1.DocumentText = My.Resources.Contents
    End Sub
End Class