本文整理汇总了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,
}
);
示例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
示例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
// {
// };
//.........这里部分代码省略.........