当前位置: 首页>>代码示例>>C#>>正文


C# IHTMLElement.AttachToDocument方法代码示例

本文整理汇总了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);

		}
开发者ID:dcarter16,项目名称:avaloncardgames,代码行数:21,代码来源:SolitaireDocument.cs

示例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();
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:TextRotator1.cs

示例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");
            
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:60,代码来源:ImageZoomer.cs

示例4: AttachToDocument

        public static IHTMLElement AttachToDocument(this IHTMLElement.HTMLElementEnum node)
        {
            var e = new IHTMLElement(node);

            e.AttachToDocument();
            return e;
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:7,代码来源:Application.cs

示例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;
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:14,代码来源:DemoControl.cs

示例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();
                    }
                };

        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ExampleGalleryAbstract.cs


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