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


C# IHTMLDiv.removeChild方法代码示例

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


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

示例1: Application

        /// <summary>
        /// This is a javascript application.
        /// </summary>
        /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
        public Application(IDefaultPage page)
        {
            @"Hello world".ToDocumentTitle();
            // Send data from JavaScript to the server tier
            service.WebMethod2(
                @"A string from JavaScript.",
                value => value.ToDocumentTitle()
            );



            var x = new IHTMLDiv();

            var size = new
            {
                w = Native.Window.Width,
                h = Native.Window.Height
            };

            x.style.SetLocation(0, 0, size.w, size.h);

            x.style.backgroundColor = Color.Blue;
            x.style.color = Color.Yellow;
            x.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;

            x.AttachToDocument();

            Action<string> Append =
                e =>
                {
                    x.appendChild(new IHTMLDiv(e));

                    if (x.childNodes.Length > 20) x.removeChild(x.firstChild);

                };

            Append("size: " + size);

            Native.Document.onkeydown +=
                ev => Append("keydown: " + ev.KeyCode);


            Native.Document.onkeyup +=
                ev => Append("keyup: " + ev.KeyCode);

            Native.Document.onkeypress +=
                ev => Append("keypress: " + ev.KeyCode);


            Native.Document.onclick +=
                ev => Append("click: " + ev.OffsetPosition);

            Native.Document.body.ontouchstart +=
            ev =>
            {
                ev.PreventDefault();

                Append("ontouchstart: " + ev.touches.length);
            };



            Native.Document.body.ontouchmove +=
            ev =>
            {
                ev.PreventDefault();

                Append("ontouchmove: " + ev.touches.length + new { 
                    ev.touches[0].clientX, ev.touches[0].clientY });
            };

            Native.Document.body.ontouchend +=
                ev =>
                {
                    ev.PreventDefault();

                    Append("ontouchend: " + 
                        new { 
                            touches = ev.touches.length, 
                            changedTouches = ev.changedTouches.length ,
                            targetTouches = ev.targetTouches.length 
                        }
                    );
                };



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


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