當前位置: 首頁>>代碼示例>>C#>>正文


C# IHTMLDiv.setAttribute方法代碼示例

本文整理匯總了C#中ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv.setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# IHTMLDiv.setAttribute方法的具體用法?C# IHTMLDiv.setAttribute怎麽用?C# IHTMLDiv.setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv的用法示例。


在下文中一共展示了IHTMLDiv.setAttribute方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: InternalSetDataSource


//.........這裏部分代碼省略.........
                    __RowsTableBody.insertBefore(__tr, InternalNewRow.InternalZeroColumnTableRow);

                    var InternalTableColumn = __tr.AddColumn();

                    var tr = new IHTMLTableRow { };
                    __ContentTableBody.insertBefore(tr, InternalNewRow.InternalTableRow);

                    InternalPrerenderZeroRows.Enqueue(__tr);
                    InternalPrerenderRows.Enqueue(tr);

                    // http://www.w3.org/TR/html5/tabular-data.html#the-table-element

                    var PrerenderData = (PrerenderStopwatch.ElapsedMilliseconds < 50);

                    //for (int ic = 0; ic < SourceDataTableColumnCount; ic++)
                    // visible columns?
                    for (int ic = 0; ic < this.Columns.Count; ic++)
                    {
                        var data = DataBoundItem[ic];

                        var td = tr.AddColumn();
                        // http://www.w3schools.com/cssref/css3_pr_column-span.asp

                        // 4760ms event: dataGridView1 set DataSource { ColumnIndex = 6, SourceRowIndex = 9999, ElapsedMilliseconds = 4092, a = 0.4092 } 



                        if (PrerenderData)
                        {
                            // X:\jsc.svn\examples\javascript\Test\TestManyTableRows\TestManyTableRows\Application.cs
                            // we need a special div to play relative 
                            var td_div = new IHTMLDiv { }.AttachTo(td);

                            td_div.setAttribute("data", data);
                        }
                        else
                        {
                            //td.colSpan = SourceDataTableColumnCount;

                            // visible columns?
                            td.colSpan = this.Columns.Count;
                            break;
                        }
                    }

                    #endregion



                    // 6881ms event: dataGridView1 set DataSource { ColumnIndex = 6, SourceRowIndex = 998, ElapsedMilliseconds = 6590, a = 6.596596596596597 } 

                }
#endif
                PrerenderStopwatch.Stop();
                if (PrerenderStopwatch.ElapsedMilliseconds > 30)
                    Console.WriteLine(
                        "event: "
                        + this.Name
                        + " set DataSource prerender "
                        + new
                        {
                            //SourceDataTableColumnCount,
                            SourceDataTableRowCount,
                            PrerenderStopwatch.ElapsedMilliseconds,
                        }
                );
開發者ID:exaphaser,項目名稱:JSC-Cross-Compiler,代碼行數:67,代碼來源:DataGridView.DataSource.cs

示例2: __DataGridView


//.........這裏部分代碼省略.........


            #region CreateVerticalResizer --
            Func<IHTMLDiv> CreateVerticalResizer =
                () =>
                {
                    var r = new IHTMLDiv { className = "VerticalResizer" };

                    r.style.position = DOM.IStyle.PositionEnum.absolute;
                    r.style.height = "9px";
                    r.style.left = "0px";
                    r.style.width = "200px";
                    //HorizontalResizer.style.backgroundColor = JSColor.Red;
                    //r.style.cursor = DOM.IStyle.CursorEnum.move;

                    var l = new IHTMLDiv().AttachTo(r);

                    l.style.position = DOM.IStyle.PositionEnum.absolute;
                    l.style.top = "4px";
                    l.style.height = "1px";
                    l.style.left = "0px";
                    l.style.right = "0px";

                    //l.style.backgroundColor = this.InternalBackgroundColor.ToString();
                    ////l.style.backgroundColor = "yellow";

                    //InternalBackgroundColorChanged +=
                    //    delegate
                    //    {
                    //        l.style.backgroundColor = this.InternalBackgroundColor.ToString();
                    //    };


                    l.setAttribute("data-resizer", "resizer");

                    //this.InternalGridColorTargets.Add(
                    //     l.css
                    // );



                    this.ClientSizeChanged +=
                       delegate
                       {
                           r.style.width = "200x";
                           //r.Hide();

                           Native.window.requestAnimationFrame +=
                               //new ScriptCoreLib.JavaScript.Runtime.Timer(
                               delegate
                               {
                                   r.style.width = this.InternalScrollContainerElement.clientWidth + "px";
                                   //l.style.backgroundColor = "red";
                                   //r.Show();

                               }
                           ;
                           //).StartTimeout(200);
                       };


                    return r;
                };
            #endregion

開發者ID:exaphaser,項目名稱:JSC-Cross-Compiler,代碼行數:65,代碼來源:DataGridView..ctor.cs

示例3: 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(IApp page)
        {
            // X:\jsc.svn\examples\javascript\Test\TestManyTableRowsFromDataTable\TestManyTableRowsFromDataTable\Application.cs
            (page.title.css | page.head.css).style.display = IStyle.DisplayEnum.block;

            // shall our .htm elements start recording their .ctor stopwatch yet?
            var s = Stopwatch.StartNew();

            var table = new IHTMLTable { border = 1 };


            //table.AttachToDocument();
            var tbody = table.AddBody();

            tbody.css.odd.style.backgroundColor = "gray";
            tbody.css[IHTMLElement.HTMLElementEnum.tr].hover.style.textDecoration = "underline";

            // http://www.joepettersson.com/demo/the-outline-property/

            var cssf = tbody.css[IHTMLElement.HTMLElementEnum.tr].children.focus;

            cssf.style.color = "red";

            //var cssf = tbody.css[IHTMLElement.HTMLElementEnum.tr][IHTMLElement.HTMLElementEnum.div].outli;

            //tbody.onclick +=
            //    delegate
            //    {
            //        ("onclick").ToDocumentTitle();

            //    };

            var a = tbody.css[IHTMLElement.HTMLElementEnum.tr]
                [IHTMLElement.HTMLElementEnum.td]
                // ie, firefox workround.
                // chrome does not need that div!
                [IHTMLElement.HTMLElementEnum.div];



            a.style.position = IStyle.PositionEnum.relative;
            a.style.width = "100%";
            a.style.height = "100%";

            tbody.css[IHTMLElement.HTMLElementEnum.tr][IHTMLElement.HTMLElementEnum.td].style.width = "10em";
            tbody.css[IHTMLElement.HTMLElementEnum.tr][IHTMLElement.HTMLElementEnum.td].style.height = "22px";

            var div = tbody.css
                [IHTMLElement.HTMLElementEnum.tr]
                [IHTMLElement.HTMLElementEnum.td]
                [IHTMLElement.HTMLElementEnum.div]
                .before;

            //[IHTMLElement.HTMLElementEnum.div];
            div.style.position = IStyle.PositionEnum.absolute;

            div.style.left = "0px";
            div.style.top = "0px";

            div.style.right = "0px";
            div.style.bottom = "0px";

            div.style.border = "1px solid red";

            //div.style.width = "100%";
            //div.style.height = "100%";


            div.contentXAttribute = new XAttribute("data", "");


            var count = 10000;

            for (int i = 0; i < count; i++)
            {
                var tr = tbody.AddRow();
                var td = tr.AddColumn();

                //td.style.position = IStyle.PositionEnum.relative;

                //var label = new IHTMLLabel { new { i } }.AttachTo(td);
                var label = new IHTMLDiv { }.AttachTo(td);


                label.setAttribute("data", new { i });
                //td.setAttribute("data", new { i });


                //label.href = "#";

                //label.onfocus +=
                //    delegate
                //    {

                //    };

//.........這裏部分代碼省略.........
開發者ID:exaphaser,項目名稱:JSC-Cross-Compiler,代碼行數:101,代碼來源:Application.cs


注:本文中的ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv.setAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。