本文整理汇总了C#中HTMLDocument类的典型用法代码示例。如果您正苦于以下问题:C# HTMLDocument类的具体用法?C# HTMLDocument怎么用?C# HTMLDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HTMLDocument类属于命名空间,在下文中一共展示了HTMLDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例3: AllFramesProcessor
public AllFramesProcessor(HTMLDocument htmlDocument)
{
Elements = new List<INativeDocument>();
_htmlDocument = htmlDocument;
_iFrameElements = (IHTMLElementCollection)htmlDocument.all.tags("iframe");
}
示例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";
}
示例5: DocHTML
public DocHTML(HTMLDocument doc)
{
mDoc = doc;
mDoc2 = (IHTMLDocument2)mDoc;
mDoc3 = (IHTMLDocument3)mDoc;
mDoc4 = (IHTMLDocument4)mDoc;
mDoc5 = (IHTMLDocument5)mDoc;
}
示例6: GetFrameCountFromHTMLDocument
internal static int GetFrameCountFromHTMLDocument(HTMLDocument htmlDocument)
{
var processor = new FrameCountProcessor(htmlDocument);
IEUtils.EnumIWebBrowser2Interfaces(processor);
return processor.FramesCount;
}
示例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;
}
示例8: GetFrameFromHTMLDocument
internal static IWebBrowser2 GetFrameFromHTMLDocument(int frameIndex, HTMLDocument htmlDocument)
{
var processor = new FrameByIndexProcessor(frameIndex, htmlDocument);
IEUtils.EnumIWebBrowser2Interfaces(processor);
return processor.IWebBrowser2();
}
示例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);
}
}
示例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";
}
示例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";
}
示例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";
}
示例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;
}
示例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;
}
示例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();
}