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


C# IHTMLElement.insertNextSibling方法代码示例

本文整理汇总了C#中IHTMLElement.insertNextSibling方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLElement.insertNextSibling方法的具体用法?C# IHTMLElement.insertNextSibling怎么用?C# IHTMLElement.insertNextSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHTMLElement的用法示例。


在下文中一共展示了IHTMLElement.insertNextSibling方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Butterfly

        public Butterfly(IHTMLElement e)
        {


            e.insertNextSibling(Control);

            Control.appendChild(@"
There is a buttrfly under your mouse. 
Can you see it? :)
Click to capture pointer lock and see how the butterfly warps from left to right.
");

            Spawn(Control);


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

示例2: HulaGirl

        public HulaGirl(IHTMLElement e)
        {
            IHTMLImage[] Frames = new HTML.Pages.FramesImages().Images;


            e.insertNextSibling(Control);

            Control.innerHTML = "hello world (javascript) : " /* base.SpawnString*/;

            Control.onmouseover += delegate { Style.color = Color.Blue; };
            Control.onmouseout += delegate { Style.color = Color.None; };

            Style.cursor = IStyle.CursorEnum.pointer;

            var btn = IHTMLButton.Create("go!",
                    delegate
                    {
                        Control.innerHTML = "you clicked me!";

                    }
                );








            var img = Frames[52];

            img.AttachToDocument();

            var _width = 120;
            var _height = 100;
            var _zoom = 1.0;

            Native.Document.body.onmousewheel +=
                ev =>
                {
                    _zoom += 0.1 * ev.WheelDirection;

                    img.style.width = (_width * _zoom) + "px";
                    img.style.height = (_height * _zoom) + "px";
                };

            var index = 0;

            new Timer(
                delegate
                {

                    index++;

                    if (index >= Frames.Length)
                        index = 0;

                    img.Orphanize();
                    img = Frames[index].AttachToDocument();
                    img.style.width = (_width * _zoom) + "px";
                    img.style.height = (_height * _zoom) + "px";

                }, 0, 1000 / 24);



            //var bytes = frames.Sum(x => x.Length);
            //Console.WriteLine(new { bytes });


            // Error	4	The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.	X:\jsc.svn\examples\javascript\HulaGirl\HulaGirl\Library\HulaGirl.cs	89	26	HulaGirl
            //var frames = await Task.WhenAll(Frames.Select(k => k.bytes));



            new IHTMLButton { innerText = "gif" }.AttachToDocument().WhenClicked(
                 async xbtn =>
                 {
                     Action<int> y = xindex =>
                            {
                                xbtn.innerText = new { xindex, Frames.Length }.ToString();

                            };

                     Console.WriteLine("are we loaded yet? " + new { Frames.Length });

                     // Error	4	The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.	X:\jsc.svn\examples\javascript\HulaGirl\HulaGirl\Library\HulaGirl.cs	89	26	HulaGirl
                     //var bytes = await Task.WhenAll(frames);
                     //var bytes = await Task.WhenAll(Frames.Select(k => k.bytes));
                     //byte[][] bytes = await frames;

                     //frames = (from f in Frames select f.bytes).ToArray();
                     // why do we have to use static?
                     //bytes = await Task.WhenAll(frames);

                     // Error	5	Cannot await 'System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<byte[]>>'	X:\jsc.svn\examples\javascript\HulaGirl\HulaGirl\Library\HulaGirl.cs	117	34	HulaGirl
                     var bytes = await from f in Frames select f.bytes;
                     //bytes.DebuggerBreakIfMissing();

                     //Console.WriteLine("are we loaded yet? yes " + new { bytes.Length });
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:HulaGirl.cs

示例3: LightsOut2


//.........这里部分代码省略.........
                () =>
                {
                    info_stats_clicks.innerHTML = info_stats_clicks_count + " clicks made so far";
                    info_stats_on.innerHTML = m.Count(i => i) + " blocks are on";
                    info_stats_off.innerHTML = m.Count(i => !i) + " blocks are off";

                };

            var info_stats = new IHTMLDiv(info_stats_clicks, info_stats_off, info_stats_on);
            info_stats.className = "info";


            a.ForEach(
                (x, y) =>
                {
                    var n = new IHTMLDiv();

                    n.style.left = (x * usersettings.tile.w + usersettings.tile.w / 2) + "px";
                    n.style.top = (y * usersettings.tile.h + usersettings.tile.h / 2) + "px";
                    n.style.width = usersettings.tile.w + "px";
                    n.style.height = usersettings.tile.h + "px";
                    n.style.position = IStyle.PositionEnum.absolute;
                    n.style.overflow = IStyle.OverflowEnum.hidden;

                    //n.style.border = "1px solid black";
                    n.style.cursor = IStyle.CursorEnum.pointer;

                    canvas.appendChild(n);

                    var tween = new TweenDataDouble();


                    tween.ValueChanged += () => n.style.Opacity = tween.Value;
                    tween.Value = usersettings.tile.cold;

                    n.style.Opacity = tween.Value;

                    n.onmouseover += delegate
                    {
                        tween.Value = 1;
                        //canvas_bg_tween.Value = 0.5;
                    };

                    n.onmouseout += delegate
                    {
                        tween.Value = usersettings.tile.cold;
                        //canvas_bg_tween.Value = 1;
                    };

                    n.onclick += delegate
                    {
                        info_stats_clicks_count++;

                        Toggle(x, y);


                        info_stats_update();
                    };


                    a[x, y] = n;

                    UpdateColor(x, y);

                }
            );

            var ani = new Timer(t =>
                               canvas_bg.style.left = -(int)System.Math.Floor((double)((IDate.Now.getTime() / 75) % canvas_size.x)) + "px");




            var info = new IHTMLDiv();

            var info_header_text = "Lights out 2";

            Native.Document.title = info_header_text;

            info.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.h1, info_header_text));

            info.appendChild(new IHTMLAnchor("http://www.cjcraft.com/Blog/PermaLink,guid,5c35b1f1-dc66-4d85-ac04-22fc97503d4a.aspx", "based on SilverlightsOut"));
            info.appendChild(new IHTMLBreak());
            info.appendChild(new IHTMLAnchor("http://www.cjcraft.com/Blog/CommentView,guid,5c35b1f1-dc66-4d85-ac04-22fc97503d4a.aspx", "cjcraft blog post"));

            info.appendChild(new IHTMLElement(IHTMLElement.HTMLElementEnum.p,
                @"Lights out is a one player puzzle that is played on a 5 by 5 grid of squares in which every square has two states: on and off. The game starts off with all squares off, where the goal is to turn on every square. By selecting a square, all the surrounding squares' (up, down, left, right) state is turned toggled. For example, on a 3 by 3 grid of squares with all squares off, if the center one is selected, it will turn 'on' the 4 up, down, left, right squares from it."));

            info.appendChild(new IHTMLDiv("Mozilla based browsers seem to suffer in performance while animating contents under semitransparent elements."));

            info.appendChild(new IHTMLButton("Animate background").Aggregate(btn => btn.onclick += delegate { ani.StartInterval(50); }));
            info.appendChild(new IHTMLButton("Freeze background").Aggregate(btn => btn.onclick += delegate { ani.Stop(); }));
            info.appendChild(info_stats);
            info.appendChild(canvas);

            info_stats_update();

            DataElement.insertNextSibling(info);

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


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