本文整理汇总了C#中IHTMLDocument2.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLDocument2.ToString方法的具体用法?C# IHTMLDocument2.ToString怎么用?C# IHTMLDocument2.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLDocument2
的用法示例。
在下文中一共展示了IHTMLDocument2.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDocCompleted
private static void OnDocCompleted(int procId, IHTMLDocument2 doc)
{
Console.WriteLine(procId.ToString() + ") OnDocCompleted called [Doc:" + doc.ToString() + "]");
//on document completion add our custom DIV
//create sample element
IHTMLElement elem = doc.createElement("div");
elem.innerHTML = "Hello from RemoteCOM";
elem.setAttribute("id", "RemoteCOM_SampleDiv", 0);
//style it
IHTMLStyle2 style2 = elem.style as IHTMLStyle2;
style2.right = 0;
elem.style.top = 0;
style2.position = "absolute";
elem.style.border = "2px solid #FFFF00";
elem.style.background = "#FFFFC0";
elem.style.zIndex = 10000;
elem.style.font = "bold 12px Helvetica";
elem.style.padding = "5px";
//insert new element into body
IHTMLDOMNode bodyNode = doc.body as IHTMLDOMNode;
IHTMLDOMNode elemNode = elem as IHTMLDOMNode;
bodyNode.appendChild(elemNode);
//remember to force release com objects
Marshal.ReleaseComObject(elem);
Marshal.ReleaseComObject(style2);
Marshal.ReleaseComObject(elemNode);
Marshal.ReleaseComObject(bodyNode);
return;
}