本文整理汇总了C#中IHTMLElement.AttachToDocument方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLElement.AttachToDocument方法的具体用法?C# IHTMLElement.AttachToDocument怎么用?C# IHTMLElement.AttachToDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLElement
的用法示例。
在下文中一共展示了IHTMLElement.AttachToDocument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SolitaireDocument
public SolitaireDocument(IHTMLElement e)
{
Native.Document.body.style.backgroundColor = Color.Black;
// wpf here
var clip = new IHTMLDiv();
clip.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative;
clip.style.SetSize(TargetCanvas.DefaultWidth, TargetCanvas.DefaultHeight);
clip.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;
var c = new IHTMLElement(IHTMLElement.HTMLElementEnum.center, clip);
if (e == null)
c.AttachToDocument();
else
e.insertPreviousSibling(c);
new TargetCanvas().AttachToContainer(clip);
}
示例2: GenerateView
//.........这里部分代码省略.........
var delay_delayed = false;
Status = "creating actions";
var Delay = default(System.Action<System.Action, int>);
Delay = (h, due) => new Timer(
delegate
{
if (delay_delayed)
Delay(h, due);
else
h();
}, due, 0);
System.Func<string> CurrentLineString = () => (1 + index) + ". " + lines[index].Trim();
var DeleteChar = default(System.Action);
var PrintChar = default(System.Action);
var ChooseLine = default(System.Action);
DeleteChar =
() =>
{
index_char--;
span.innerText = CurrentLineString().Substring(0, index_char);
if (index_char == 0)
{
ChooseLine();
}
else
{
Delay(DeleteChar, 30);
}
};
PrintChar =
() =>
{
index_char++;
if (index_char < CurrentLineString().Length)
{
var x = 100;
var y = CurrentLineString()[index_char];
if (",. \t\n".Contains("" + y))
x = 200;
if (index_char > 1)
span.style.color = Color.None;
span.innerText = CurrentLineString().Substring(0, index_char);
Delay(PrintChar, x);
}
else
{
Delay(DeleteChar, 3000);
}
};
ChooseLine =
() =>
{
index = new System.Random().Next() % lines.Length;
index_char = 0;
span.innerText = "";
span.style.color = Color.White;
PrintChar();
};
Status = "adding to document";
c.onmouseover +=
delegate
{
c.style.color = Color.Yellow;
delay_delayed = true;
};
c.onmouseout +=
delegate
{
c.style.color = Color.None;
delay_delayed = false;
};
c.appendChild(span, cursor);
c.AttachToDocument();
ChooseLine();
}
示例3: ImageZoomer
/// <summary>
/// Creates a new control
/// </summary>
/// <param name="DataElement">The hidden data element</param>
public ImageZoomer()
{
var Control = new IHTMLElement(IHTMLElement.HTMLElementEnum.center);
Control.AttachToDocument();
Control.appendChild( new IHTMLDiv("A simple image zoomer example") );
Control.appendChild(new IHTMLAnchor("http://valid.tjp.hu/tjpzoom/", "based on tjpZoom"));
Control.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.p, "Use your mouse wheel to zoom!"));
Control.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.hr));
System.Action<string, string> Spawn =
(src, zoom_src) =>
{
var i = new IHTMLImage(src);
i.style.margin = "2px";
Control.appendChild(i);
// note: image should be loeaded before attaching events on it!
i.InvokeOnComplete(
(img) => MyMagnifier.CreateClickableMagnifier(i, zoom_src)
);
};
System.Action<string, string> SpawnFreezable =
(src, zoom_src) =>
{
var i = new IHTMLImage(src);
i.style.margin = "2px";
Control.appendChild(i);
i.InvokeOnComplete(
(img) => MyMagnifier.CreateFreezableMagnifier(i, zoom_src)
);
};
Control.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.p, "Click to disable or re-enable the magnifier!"));
new[] {
"assets/ImageZoomer/boat.jpg",
"assets/ImageZoomer/boat2.jpg",
"assets/ImageZoomer/tea.jpg",
"assets/ImageZoomer/town.jpg",
}.ForEach( src => Spawn(src, src) );
Control.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.p, "Click to freeze the magnifier!"));
SpawnFreezable("assets/ImageZoomer/belchite_bw.jpg", "assets/ImageZoomer/belchite.jpg");
SpawnFreezable("assets/ImageZoomer/belchite.jpg", "assets/ImageZoomer/belchite_bw_neg.jpg");
}
示例4: AttachToDocument
public static IHTMLElement AttachToDocument(this IHTMLElement.HTMLElementEnum node)
{
var e = new IHTMLElement(node);
e.AttachToDocument();
return e;
}
示例5: ImportStyleSheet
static IHTMLElement ImportStyleSheet(string url)
{
Console.WriteLine("importing css at " + url);
var s = new IHTMLElement(IHTMLElement.HTMLElementEnum.link);
s.setAttribute("rel", "stylesheet");
s.setAttribute("type", "text/css");
s.setAttribute("href", url);
s.AttachToDocument();
return s;
}
示例6: Initialize
//.........这里部分代码省略.........
let image = new IHTMLImage(preview)
orderby t.Name
select new { t, assembly, preview, image };
var ApplicationsWithLoadingImages = ApplicationsWithLoadingImagesQuery.ToArray();
var LoadingMessage = new IHTMLDiv().AttachTo(Menu);
var DoneLoading = 500.Until(
t =>
{
var count = ApplicationsWithLoadingImages.Count(i => !i.image.complete);
LoadingMessage.innerText = count + " images are still loading...";
return (count == 0 || t.Counter == 6);
}
);
Func<Point> GetCenter =
() => new Point(Native.Window.Width / 2, Native.Window.Height / 2);
Action<Type> TypeClicked = t => { };
DoneLoading +=
delegate
{
var query = from i in ApplicationsWithLoadingImages
let hasimage = i.image.complete && i.image.width > 0
select new { i.image, i.t, i.assembly, hasimage, i.preview }; ;
var WithImages =
from i in query
where i.hasimage
select i;
var WithoutImages =
from i in query
where !i.hasimage
select i;
#region WithImages
DoneLoading = WithImages.ForEachAtInterval(50,
v =>
{
LoadingMessage.innerText = v.t.Name;
var href = v.t.Name + ".htm";
var r = ConvertImageToControl(v.image, href, v.t, TypeClicked);
r.AttachTo(Menu);
}
);
#endregion
DoneLoading +=
delegate
{
LoadingMessage.Dispose();
var clr = new IHTMLBreak();
clr.style.clear = "both";
clr.AttachTo(Menu);
foreach (var v in WithoutImages)
{
new IHTMLDiv("image not found: " + v.preview).AttachTo(Menu);
}
"script".DisposeElementsByTagName();
"noscript".DisposeElementsByTagName();
};
};
TypeClicked +=
t =>
{
Menu.Dispose();
try
{
Activator.CreateInstance(t);
}
catch (Exception exc)
{
Native.Window.alert("Error: " + exc.Message);
Menu.AttachToDocument();
}
};
}