本文整理汇总了C#中System.Windows.Forms.HtmlElementInsertionOrientation枚举的典型用法代码示例。如果您正苦于以下问题:C# HtmlElementInsertionOrientation枚举的具体用法?C# HtmlElementInsertionOrientation怎么用?C# HtmlElementInsertionOrientation使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了HtmlElementInsertionOrientation枚举的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDivMessage
public void AddDivMessage()
{
Uri currentUri = new Uri(webBrowser1.Url.ToString());
String hostName = null;
// Ensure we have a host name, and not just an IP, against which to test.
if (!(currentUri.HostNameType == UriHostNameType.Dns))
{
DnsPermission permit = new DnsPermission(System.Security.Permissions.PermissionState.Unrestricted);
permit.Assert();
IPHostEntry hostEntry = System.Net.Dns.GetHostEntry(currentUri.Host);
hostName = hostEntry.HostName;
} else {
hostName = currentUri.Host;
}
if (!hostName.Contains("adatum.com"))
{
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.");
}
}
private void AddTopPageMessage(String message)
{
if (webBrowser1.Document != null)
{
HtmlDocument doc = webBrowser1.Document;
// Do not insert the warning again if it already exists.
HtmlElementCollection returnedElems = doc.All.GetElementsByName("ADatumWarningDiv");
if ((returnedElems != null) && (returnedElems.Count > 0))
{
return;
}
HtmlElement divElem = doc.CreateElement("DIV");
divElem.Name = "ADatumWarningDiv";
divElem.Style = "background-color:black;color:white;font-weight:bold;width:100%;";
divElem.InnerText = message;
divElem = doc.Body.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterBegin, divElem);
}
}