本文整理汇总了C#中IHTMLElement.removeChildren方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLElement.removeChildren方法的具体用法?C# IHTMLElement.removeChildren怎么用?C# IHTMLElement.removeChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLElement
的用法示例。
在下文中一共展示了IHTMLElement.removeChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GoogleGearsSimple
//public const string Alias = "Class1";
//public const string DefaultData = "Class1Data";
/// <summary>
/// Creates a new control
/// </summary>
/// <param name="DataElement">The hidden data element</param>
public GoogleGearsSimple()
{
// this ctor creates a new div which has a text and a button element
// on mouseover over the color text is changed
// on pressing the button the next message in text element is displayed
IHTMLDiv Control = new IHTMLDiv();
Control.AttachToDocument();
Func<string, string, IHTMLElement> link = (href, text) => new IHTMLDiv(new IHTMLAnchor(href, text));
Control.appendChild(link("http://gears.google.com/", "Google Gears"));
Control.appendChild(link("http://code.google.com/apis/gears/samples/hello_world_database.html", "Google Example # 1"));
Control.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.h3, "This page uses Google Gears to record your entries on the local disk. If you navigate away and revisit this page, all your data will still be here. Try it!"));
// http://code.google.com/apis/gears/samples/hello_world_database.html
GoogleGearsFactory.Database db = null;
try
{
db = new GoogleGearsFactory.Database();
}
catch (Exception exc)
{
var err = new IHTMLCode(exc.Message);
err.style.color = Color.Red;
Control.appendChild(err);
}
IStyleSheet.Default.AddRule(".odd").style.backgroundColor = Color.FromGray(0xa0);
IStyleSheet.Default.AddRule(".even").style.backgroundColor = Color.FromGray(0xef);
if (db != null)
{
db.open("demo1");
db.execute(@"
create table if not exists Demo
(Phrase varchar(255), Timestamp int)
");
var textfield = new IHTMLInput(HTMLInputTypeEnum.text, "text1", "");
var btnadd = new IHTMLButton("Add new entry");
var btnrefresh = new IHTMLButton("Refresh");
var btnclear = new IHTMLButton("Clear");
Control.appendChild(textfield, btnadd, btnclear, btnrefresh,
new IHTMLCode(GoogleGearsFactory.Default.getBuildInfo())
);
var list = new IHTMLElement(IHTMLElement.HTMLElementEnum.ol);
Control.appendChild(list);
var read = default(Action);
read = delegate
{
//from i in Demo
//select new { Phrase, Timestamp }
//order by Timestamp desc
list.removeChildren();
Func<string, IHTMLElement> AddItem =
text => new IHTMLElement(IHTMLElement.HTMLElementEnum.li, text).Aggregate(v => list.appendChild(v));
// this could be rewritten as an expression once they are supported by jsc
int counter = 0;
var query = from Data in db.AsEnumerable<DemoDataEntity>(
"select * from Demo order by Timestamp desc",
typeof(DemoDataEntity)
)
// let ListItem = AddItem(Data.Timestamp + " - " + Data.Phrase)
select new __Type2 { ListItem = AddItem(Data.Timestamp + " - " + Data.Phrase), Data = Data};
foreach (var v in query)
{
counter++;
//.........这里部分代码省略.........
示例2: AddProxy
private void AddProxy(IHTMLAnchor htext)
{
var content = new IHTMLDiv().AttachTo(DocumentBody);
// content.Hide();
htext.onclick +=
delegate
{
content.ToggleVisible();
};
var LastUpdate = new IHTMLDiv("Not updated yet").AttachTo(content);
var pre = new IHTMLElement(IHTMLElement.HTMLElementEnum.pre).AttachTo(content);
Action update =
delegate
{
LastUpdate.innerText = "Last update: " + DateTime.Now;
pre.removeChildren();
System.Console.WriteLine("Any.ProxyProvider");
RenderProxyTo(new Any.ProxyProvider(a.value), pre);
};
a.onchange += delegate { update(); };
}