• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# HTMLDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中HTMLDocument的典型用法代码示例。如果您正苦于以下问题:C# HTMLDocument类的具体用法?C# HTMLDocument怎么用?C# HTMLDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HTMLDocument类属于命名空间,在下文中一共展示了HTMLDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LoadUrl

        public static void LoadUrl(ref HTMLDocument doc, String url, bool CreateSite)
        {
            if (doc == null)
            {
                throw new HtmlEditorException("Null document passed to LoadDocument");
            }

            if (CreateSite)
            {
                //set client site to DownloadOnlySite, to suppress scripts
                DownloadOnlySite ds = new DownloadOnlySite();
                IOleObject ob = (IOleObject)doc;
                ob.SetClientSite(ds);
            }

            IPersistMoniker persistMoniker = (IPersistMoniker)doc;

            IMoniker moniker = null;

            int iResult = win32.CreateURLMoniker(null, url, out moniker);

            IBindCtx bindContext = null;

            iResult = win32.CreateBindCtx(0, out bindContext);

            iResult = persistMoniker.Load(0, moniker, bindContext, constants.STGM_READ);

            persistMoniker = null;

            bindContext = null;

            moniker = null;

        }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:34,代码来源:utils.cs


示例2: SlideTickScript

        public SlideTickScript(HTMLDocument Document)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("function slidetick(objname){");

                builder.Append("var elapsed = (new Date()).getTime() - startTime[objname];");
                builder.Append("if (elapsed > slideAniLen){");
                    builder.Append("endSlide(objname);");
                    builder.Append("}");

                builder.Append("else {");
                builder.Append("var d = Math.round(elapsed / slideAniLen * endHeight[objname]);");
                builder.Append("if(dir[objname] == 'up')");

            builder.Append("d = endHeight[objname] - d;");

                    builder.Append("obj[objname].style.height = d + 'px';");
                    builder.Append("}");

                builder.Append("return;");
            builder.Append("}");

            _script = (IHTMLScriptElement) Document.createElement("script");
            _script.type = "text/javascript";
            _script.text = builder.ToString();
        }
开发者ID:grefly,项目名称:Buy4,代码行数:27,代码来源:SlideTickScript.cs


示例3: AllFramesProcessor

        public AllFramesProcessor(HTMLDocument htmlDocument)
        {
            Elements = new List<INativeDocument>();
            _htmlDocument = htmlDocument;

            _iFrameElements = (IHTMLElementCollection)htmlDocument.all.tags("iframe");
        }
开发者ID:koshdim,项目名称:KoWatIn,代码行数:7,代码来源:AllFramesProcessor.cs


示例4: VBScriptNode

        public VBScriptNode(HTMLDocument Document)
        {
            _script = (IHTMLScriptElement)Document.createElement("script");
            ((IHTMLElement) _script).setAttribute("language", "vbscript", 0);

            _script.text = "Function decline_link_click() : Document.getElementById(\"buy4_notice\").style.display=\"none\" : End Function";
        }
开发者ID:grefly,项目名称:Buy4,代码行数:7,代码来源:VBScriptNode.cs


示例5: DocHTML

 public DocHTML(HTMLDocument doc)
 {
     mDoc = doc;
     mDoc2 = (IHTMLDocument2)mDoc;
     mDoc3 = (IHTMLDocument3)mDoc;
     mDoc4 = (IHTMLDocument4)mDoc;
     mDoc5 = (IHTMLDocument5)mDoc;
 }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:8,代码来源:DocHTML.cs


示例6: GetFrameCountFromHTMLDocument

        internal static int GetFrameCountFromHTMLDocument(HTMLDocument htmlDocument)
        {
            var processor = new FrameCountProcessor(htmlDocument);

            IEUtils.EnumIWebBrowser2Interfaces(processor);

            return processor.FramesCount;
        }
开发者ID:fschwiet,项目名称:watin_unbranched,代码行数:8,代码来源:FrameCountProcessor.cs


示例7: LoadHtml

 /// <summary>
 /// Loading method
 /// HtmlDocument to create a HTML string
 /// </summary>
 /// <param name="html">HTML string</param>
 /// <returns></returns>
 public HtmlDocument LoadHtml(string html)
 {
     // Creating an object using a mshtml.HTMLDocument
     var doc = new HTMLDocument() as IHTMLDocument2;
     doc.write(new object[] { html });
     Load(doc);
     return this;
 }
开发者ID:moonmile,项目名称:XmlDom,代码行数:14,代码来源:HtmlDocument.cs


示例8: GetFrameFromHTMLDocument

        internal static IWebBrowser2 GetFrameFromHTMLDocument(int frameIndex, HTMLDocument htmlDocument)
        {
            var processor = new FrameByIndexProcessor(frameIndex, htmlDocument);

            IEUtils.EnumIWebBrowser2Interfaces(processor);

            return processor.IWebBrowser2();
        }
开发者ID:kevinswarner,项目名称:Hover_OLD,代码行数:8,代码来源:FrameByIndexProcessor.cs


示例9: OnDocumentComplete

        public void OnDocumentComplete(object pDisp, ref object URL)
        {
            document = (HTMLDocument)webBrowser.Document;

            foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT"))
            {
                System.Windows.Forms.MessageBox.Show(
                    tempElement.name != null ? tempElement.name : "it sucks, no name, try id" + ((IHTMLElement)tempElement).id);
            }
        }
开发者ID:Piick,项目名称:extensions,代码行数:10,代码来源:BHO.cs


示例10: DeclineHyperlink

        public DeclineHyperlink(HTMLDocument Document)
        {
            _anchor = Document.createElement("a");
            _anchor.setAttribute("href", "javascript:decline_link_click()", 0);

            _anchor.style.fontSize = "x-small";
            _anchor.style.fontWeight = "normal";

            _anchor.innerText = "No, thanks";
        }
开发者ID:grefly,项目名称:Buy4,代码行数:10,代码来源:DeclineHyperlink.cs


示例11: AcceptHyperlink

        public AcceptHyperlink(HTMLDocument Document, string AcceptUrl, string StoreID)
        {
            _anchor = Document.createElement("a");
            _anchor.setAttribute("href", "javascript:accept_link_click();",0);
            _anchor.setAttribute("id", "accept_link", 0);

            _anchor.style.fontSize = "x-small";
            _anchor.style.fontWeight = "bold";

            _anchor.innerText = "Yes, Log Me In";
        }
开发者ID:grefly,项目名称:Buy4,代码行数:11,代码来源:AcceptHyperlink.cs


示例12: YesLink

        public YesLink(HTMLDocument Document, string AcceptUrl, string StoreID, string ReturnUrl)
        {
            _yes_link = Document.createElement("a");

            AcceptUrl = AcceptUrl
                .Replace("###id###", StoreID)
                .Replace("###return_url###", ReturnUrl);

            _yes_link.setAttribute("href",AcceptUrl,0);
            _yes_link.setAttribute("id", "yes_link",0);
            _yes_link.innerText = "Yes";
        }
开发者ID:grefly,项目名称:Buy4,代码行数:12,代码来源:YesLink.cs


示例13: Login

        /// <summary>
        /// Log-into the web application.
        /// </summary>
        /// <param name="navigationUrl">The navigation URL.</param>
        /// <param name="userNameTextBoxID">The user name text box ID.</param>
        /// <param name="passwordTextBoxID">The password text box ID.</param>
        public static void Login(string navigationUrl, string userNameTextBoxID, string passwordTextBoxID)
        {
            InternetExplorer browser = new InternetExplorer();
            object mVal = System.Reflection.Missing.Value;
            browser.Navigate(navigationUrl, ref mVal, ref mVal, ref mVal, ref mVal);

            HTMLDocument pageDocument = new HTMLDocument();
            System.Threading.Thread.Sleep(2000);
            pageDocument = (HTMLDocument)browser.Document;
            LoginInternal(userNameTextBoxID, passwordTextBoxID, pageDocument);
            browser.Visible = true;

        }
开发者ID:mavrk,项目名称:nagarro-SingleSignOn,代码行数:19,代码来源:WebsiteLogin.cs


示例14: create_display_div

        public static IHTMLDOMNode create_display_div(HTMLDocument document,Store store,config config)
        {
            IHTMLElement div = document.createElement("div");

            /* This will be removed */
            YesLink yes = new YesLink(document, config.accept_url, store.id, document.url);

            ((IHTMLDOMNode) div).appendChild((IHTMLDOMNode) yes.Element);

            /* End removed */

            return (IHTMLDOMNode) div;
        }
开发者ID:grefly,项目名称:Buy4,代码行数:13,代码来源:DisplayDivFactory.cs


示例15: AcceptLinkClickScript

        public AcceptLinkClickScript(HTMLDocument Document)
        {
            StringBuilder builder = new StringBuilder();

            // This function is called when the user clicks the YES, LOG ME IN link
            builder.Append("function accept_click(){");
            builder.Append("set_cookie_cache();");
            builder.Append("}");

            _script = (IHTMLScriptElement) Document.createElement("script");
            _script.type = "text/javascript";
            _script.text = builder.ToString();
        }
开发者ID:grefly,项目名称:Buy4,代码行数:13,代码来源:AcceptLinkClickScript.cs


示例16: DeclineLinkClickScript

        public DeclineLinkClickScript(HTMLDocument Document)
        {
            StringBuilder builder = new StringBuilder();

            // This function is called when the user clicks the NO THANKS link
            builder.Append("function decline_click(){");
            builder.Append("set_cookie_cache();");
            builder.Append("slideup('buy4_notice');");
            builder.Append("}");

            _script = (IHTMLScriptElement) Document.createElement("script");
            _script.type = "text/javascript";
            _script.text = builder.ToString();
        }
开发者ID:grefly,项目名称:Buy4,代码行数:14,代码来源:DeclineLinkClickScript.cs


示例17: NoticeDiv

        public NoticeDiv(HTMLDocument Document,Buy4Configuration Config, Store Store)
        {
            _div = Document.createElement("div");
            _div.innerHTML = Config.GetContent(Store, Document.url);
            _div.style.cssText = Config.GetStyle();

            _div.setAttribute("id", "buy4_notice", 0);
            ((IHTMLStyle2) _div.style).overflowX = "hidden";
            ((IHTMLStyle2) _div.style).overflowY = "hidden";
            ((IHTMLStyle2) _div.style).position = "relative";
            _div.style.display = "none";
            _div.style.filter = "alpha(opacity=95)";
            _div.style.zIndex = 1000;
        }
开发者ID:grefly,项目名称:Buy4,代码行数:14,代码来源:NoticeDiv.cs


示例18: OnBeforeNavigate2

        public void OnBeforeNavigate2(object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel)
        {
            document = (HTMLDocument)webBrowser.Document;

            foreach (IHTMLInputElement tempElement in document.getElementsByTagName("INPUT"))
            {
                if (tempElement.type.ToLower() == "password")
                {

                    System.Windows.Forms.MessageBox.Show(tempElement.value);
                }

            }
        }
开发者ID:Piick,项目名称:extensions,代码行数:14,代码来源:BHO.cs


示例19: AllFramesProcessor

        public AllFramesProcessor(HTMLDocument htmlDocument)
        {
            Elements = new List<INativeDocument>();

            frameElements = (IHTMLElementCollection) htmlDocument.all.tags("frame");

            // If the current document doesn't contain FRAME elements, it then
            // might contain IFRAME elements.
            if (frameElements.length == 0)
            {
                frameElements = (IHTMLElementCollection)htmlDocument.all.tags("iframe");
            }

            this.htmlDocument = htmlDocument;
        }
开发者ID:fschwiet,项目名称:WatiN-2.0.20.1089-net-2.0,代码行数:15,代码来源:AllFramesProcessor.cs


示例20: NavigateTo

        public void NavigateTo(Uri url)
        {
            var htmlDoc = new HTMLDocument();
            var ips = (IPersistStreamInit)htmlDoc;
            ips.InitNew();

            var htmlDoc2 = htmlDoc.createDocumentFromUrl(url.AbsoluteUri, "null");

            while (htmlDoc2.readyState != "complete")
            {
                //This is also a important part, without this DoEvents() appz hangs on to the “loading”
                Application.DoEvents();
            }
            _ieDocument = new IEDocument(htmlDoc2);
        }
开发者ID:vearvindkumar,项目名称:Scrapper,代码行数:15,代码来源:MsHtmlNativeBrowser.cs



注:本文中的HTMLDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HTMLElementType类代码示例发布时间:2022-05-24
下一篇:
C# HSteamUser类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap