HtmlElementInsertionOrientation 列挙体とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlElementInsertionOrientation 列挙体の意味・解説 

HtmlElementInsertionOrientation 列挙体

メモ : この列挙体は、.NET Framework version 2.0 で新しく追加されたものです。

InsertAdjacentElement の使用時に新しい要素が挿入される位置を表す値を定義します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Enumeration HtmlElementInsertionOrientation
Dim instance As HtmlElementInsertionOrientation
public enum HtmlElementInsertionOrientation
public enum class HtmlElementInsertionOrientation
public enum HtmlElementInsertionOrientation
public enum HtmlElementInsertionOrientation
メンバメンバ
使用例使用例

次のコード例では、ユーザーが ADatum.com サーバー以外から表示するすべてのページの最上部に、DIV 要素を挿入します。この例では、フォームに WebBrowser1 という名前の WebBrowser コントロールが含まれている必要があります。また、名前空間 System.Text.RegularExpressions をインポートする必要もあります。

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);
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

HtmlElementInsertionOrientation 列挙体のお隣キーワード

   

英語⇒日本語
日本語⇒英語
   



HtmlElementInsertionOrientation 列挙体のページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS