本文整理汇总了VB.NET中System.Windows.Forms.HtmlElement.InsertAdjacentElement方法的典型用法代码示例。如果您正苦于以下问题:VB.NET HtmlElement.InsertAdjacentElement方法的具体用法?VB.NET HtmlElement.InsertAdjacentElement怎么用?VB.NET HtmlElement.InsertAdjacentElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.HtmlElement
的用法示例。
在下文中一共展示了HtmlElement.InsertAdjacentElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: AddDivMessage
Private Sub AddDivMessage()
Dim CurrentUri As New Uri(WebBrowser1.Url.ToString())
Dim HostName As String
' Ensure we have a host name, and not just an IP, against which to test.
If (Not CurrentUri.HostNameType = UriHostNameType.Dns) Then
Dim Permit As New DnsPermission(System.Security.Permissions.PermissionState.Unrestricted)
Permit.Assert()
Dim HostEntry As IPHostEntry = System.Net.Dns.GetHostEntry(CurrentUri.Host)
HostName = HostEntry.HostName
Else
HostName = CurrentUri.Host
End If
If (Not HostName.Contains("adatum.com")) Then
AddTopPageMessage("You are viewing a web site other than ADatum.com. " & _
"Please exercise caution, and ensure your web surfing complies with all " & _
"corporate regulations as laid out in the company handbook.")
End If
End Sub
Private Sub AddTopPageMessage(ByVal Message As String)
If (WebBrowser1.Document IsNot Nothing) Then
With WebBrowser1.Document
' Do not insert the warning again if it already exists.
Dim ReturnedElems As HtmlElementCollection = .All.GetElementsByName("ADatumWarningDiv")
If (Not (ReturnedElems Is Nothing) And (ReturnedElems.Count > 0)) Then
Exit Sub
End If
Dim DivElem As HtmlElement = .CreateElement("DIV")
DivElem.Name = "ADatumWarningDiv"
DivElem.Style = "background-color:black;color:white;font-weight:bold;width:100%;"
DivElem.InnerText = Message
DivElem = .Body.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, DivElem)
End With
End If
End Sub