本文整理汇总了C#中ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv.AttachTo方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLDiv.AttachTo方法的具体用法?C# IHTMLDiv.AttachTo怎么用?C# IHTMLDiv.AttachTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv
的用法示例。
在下文中一共展示了IHTMLDiv.AttachTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RedNumberDisplay
public RedNumberDisplay(int Digits, int value, Assets MyAssets)
{
this.MyAssets = MyAssets;
this.Digits = Digits;
this.Control.style.SetSize(Width, Height);
this.Control.style.backgroundColor = Color.Black;
this.Control.style.position = IStyle.PositionEnum.relative;
DigitControls = Enumerable.Range(0, Digits).Select(
i =>
{
var d = new IHTMLDiv();
d.style.SetLocation(i * DigitX, 0, DigitX, DigitY);
d.style.SetBackground(MyAssets.red_numbers[0]);
d.AttachTo(this.Control);
return d;
}
).ToArray();
this.Value = value;
}
示例2: XRectangle
public XRectangle()
{
var aelement = new IHTMLDiv();
// WPF: Rectangle, Image or Label
var acontent = new IHTMLDiv();
acontent.style.backgroundColor = "#ff0000";
this.Rotor = new IHTMLDiv();
//this.Rotor.style.backgroundColor = "#ffd0d0";
this.Rotor.style.border = "1px solid black";
//this.Rotor.style.paddingRight = "10px";
this.Rotor.AttachTo(aelement);
acontent.AttachTo(this.Rotor);
aelement.AttachToDocument();
Element = aelement;
Content = acontent;
}
示例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(IDefault page)
{
@"Hello world".ToDocumentTitle();
// Send data from JavaScript to the server tier
service.getExternalStoragePublicDirectory(
"",
root =>
{
Action<string, IHTMLElement> listFiles = null;
listFiles =
(xroot, xcontainer) =>
{
if (!xroot.EndsWith("/"))
xroot += "/";
new IHTMLPre { innerText = xroot }.AttachTo(xcontainer);
service.listFiles(xroot,
f =>
{
var ch = new IHTMLDiv();
ch.style.marginLeft = "1em";
new IHTMLButton { innerText = f }.AttachTo(xcontainer).With(
btn =>
{
btn.style.display = IStyle.DisplayEnum.block;
btn.onclick +=
delegate
{
if (f.EndsWith("/"))
{
listFiles(xroot + f, ch);
}
};
}
);
ch.AttachTo(xcontainer);
}
);
};
listFiles(root, Native.Document.body);
}
);
}
示例4: TextScreenSaver
//.........这里部分代码省略.........
var z = 0.5d.Random() + 0.5d;
var v = new IHTMLDiv { innerText = lines.Random() };
v.style.whiteSpace = IStyle.WhiteSpaceEnum.nowrap;
vectors.Add(v);
Action ApplyZ =
() =>
{
v.style.fontSize = (z * 3) + "em";
v.style.Opacity = z;
v.style.zIndex = (z * 1000).Floor();
};
ApplyZ();
var x = 100d;
var y = 80.Random();
v.style.position = IStyle.PositionEnum.absolute;
Action UpdatePosition =
() =>
{
v.style.left = x + "%";
v.style.top = y + "%";
};
UpdatePosition();
v.AttachTo(body);
var handler = default(Action<Timer>);
Action DisposeThisVector =
delegate
{
timer_handler -= handler;
v.FadeOut();
done();
};
v.ondblclick +=
ev =>
{
DisposeThisVector();
};
var IsHover = false;
v.onmousedown +=
ev =>
{
ev.PreventDefault();
};
v.onmouseover +=
delegate
{
示例5: Initialize
public void Initialize()
{
Native.Document.body.style.padding = "0";
Native.Document.body.style.margin = "0";
var Images = new Dictionary<string, IHTMLImage>();
var ImagesLoaded = default(Action);
Func<string, IHTMLImage> CloneImage = name => (IHTMLImage)Images[name].cloneNode(false);
var Zoom = Data.Zoom.ToDouble();
var ControlSize = new ZoomedPoint
{
Z = Zoom,
X = Data.ControlSize.Xint,
Y = Data.ControlSize.Yint
};
Control.style.SetSize(ControlSize.ZoomedXint, ControlSize.ZoomedYint);
Control.style.backgroundColor = Data.BackgroundColor;
Control.style.color = Data.TextColor;
Control.AttachAsNextOrToDocument(null);
Control.style.position = IStyle.PositionEnum.relative;
Action LoadImages =
delegate
{
Data.Sprites.ForEach(
i =>
{
Images[i.Value] = i.ImageValue;
}
);
ImagesLoaded();
};
ImagesLoaded =
delegate
{
var ClientRectPos = new ZoomedPoint
{
Z = Zoom,
X = Data.ClientRect.From.Xint,
Y = Data.ClientRect.From.Yint
};
var ClientRectSize = new ZoomedPoint
{
Z = Zoom,
X = Data.ClientRect.Size.Xint,
Y = Data.ClientRect.Size.Yint
};
var ContentLayer = new IHTMLDiv();
ContentLayer.style.backgroundColor = Data.ClientRectColor;
ContentLayer.style.overflow = IStyle.OverflowEnum.hidden;
ContentLayer.style.SetLocation(
ClientRectPos.ZoomedXint,
ClientRectPos.ZoomedYint,
ClientRectSize.ZoomedXint,
ClientRectSize.ZoomedYint
);
ContentLayer.AttachTo(Control);
//var r1 = CloneImage("room 001").AttachTo(ContentLayer);
//r1.style.SetLocation(0, 0, ClientRectSize.ZoomedXint, ClientRectSize.ZoomedYint);
Func<string, IHTMLImage> CreateRoomImage =
name =>
{
var r2 = CloneImage(name);
r2.AttachTo(ContentLayer);
var r2_Zoom = new ZoomedPoint
{
Z = Zoom,
X = Images[name].width,
Y = Images[name].height
};
r2.Hide();
r2.style.SetLocation(0, 0, r2_Zoom.ZoomedXint, r2_Zoom.ZoomedYint);
return r2;
};
var KnownRooms = new List<IHTMLImage>();
KnownRooms.AddRange(
new []
{
CreateRoomImage("room 001"),
CreateRoomImage("room 002"),
CreateRoomImage("room 024"),
//.........这里部分代码省略.........
示例6: AddNamespace
private static IHTMLDiv AddNamespace(IHTMLDiv parent, IHTMLDiv NextNamespaceOrDefault, string Namespace, Action<string> UpdateLocation)
{
var div = new IHTMLDiv();
if (NextNamespaceOrDefault == null)
div.AttachTo(parent);
else
NextNamespaceOrDefault.insertPreviousSibling(div);
div.style.marginTop = "0.1em";
div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana;
div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap;
var i = new Namespace().AttachTo(div);
i.style.verticalAlign = "middle";
i.style.marginRight = "0.5em";
if (Namespace == "")
Namespace = "<Module>";
var s = new IHTMLAnchor { innerText = Namespace }.AttachTo(div);
s.href = "#";
s.style.textDecoration = "none";
s.style.color = JSColor.System.WindowText;
Action onclick = delegate
{
};
s.onclick +=
e =>
{
e.PreventDefault();
s.focus();
UpdateLocation(Namespace);
onclick();
};
s.onfocus +=
delegate
{
s.style.backgroundColor = JSColor.System.Highlight;
s.style.color = JSColor.System.HighlightText;
};
s.onblur +=
delegate
{
s.style.backgroundColor = JSColor.None;
s.style.color = JSColor.System.WindowText;
};
var children = new IHTMLDiv().AttachTo(div);
children.style.paddingLeft = "1em";
children.Hide();
var NextClickHide = default(Action);
var NextClickShow = default(Action);
NextClickHide =
delegate
{
children.Hide();
onclick = NextClickShow;
};
NextClickShow =
delegate
{
children.Show();
onclick = NextClickHide;
};
onclick = NextClickShow;
return children;
}
示例7: 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)
{
content.AttachControlToDocument();
var ss = new DataGridView
{
DataSource = Book1.GetDataSet(),
DataMember = "Assets"
};
content.Controls.Add(ss);
var x = new IHTMLDiv();
x.style.backgroundColor = "rgba(255,255,255,1.0)";
x.style.position = IStyle.PositionEnum.absolute;
x.style.height = "auto";
x.style.width = "100%";
x.style.top = "100%";
x.style.zIndex = 999;
var temp = ss.Rows[1];
var sss = temp.Cells[0].AsHTMLElementContainer();
sss.style.backgroundColor = "red";
new TheOtherOption { }.With(
o =>
{
o.BackColor = Color.White;
o.GetHTMLTarget().With(
div =>
{
div.AttachTo(x);
div.style.position = IStyle.PositionEnum.absolute;
}
);
}
);
x.AttachTo(sss.parentNode);
x.Hide();
sss.onmouseover += delegate
{
x.Show();
};
sss.onmouseout += delegate
{
x.Hide();
};
//that.GotFocus += delegate
//{
// x.Show();
//};
//that.Leave += delegate
//{
// x.Hide();
//};
}
示例8: ConvertToImageReflection
public static IHTMLDiv ConvertToImageReflection(ReflectionSetup rs)
{
var Control = new IHTMLDiv();
Control.style.SetLocation(rs.Position.X, rs.Position.Y, +rs.Size.X, +rs.Size.Y);
rs.Image.style.SetLocation(0, 0, rs.Size.X, rs.Size.Y);
rs.Image.AttachTo(Control);
#region drag
if (rs.Drag)
{
rs.Image.onmousedown += Native.DisabledEventHandler;
rs.Image.style.cursor = ScriptCoreLib.JavaScript.DOM.IStyle.CursorEnum.move;
var drag = new DragHelper(rs.Image);
drag.Enabled = true;
drag.Position = rs.Position;
drag.DragMove +=
delegate
{
Control.style.SetLocation(drag.Position.X, drag.Position.Y);
};
}
#endregion
#region GetRect
Func<int, int, int, int, string> GetRect =
(left, top, width, height) =>
{
// rect (top, right, bottom, left)
var x = string.Format("rect({0}px, {1}px, {2}px, {3}px)", top, width + left, height + top, left);
return x;
};
#endregion
#region CopyLineY
Action<ReflectionFrameInfo> CopyLineY =
i =>
{
var clone = (IHTMLImage)rs.Image.cloneNode(true);
clone.style.SetLocation(0, i.Offset + i.To, rs.Size.X, i.Size);
clone.style.clip = GetRect(0, i.From, rs.Size.X, 1);
clone.style.Opacity = i.Opacity;
clone.AttachTo(i.Owner);
};
#endregion
#region y
var YMax = (rs.Size.Y * rs.ReflectionZoom).ToInt32();
if (rs.Bottom >= 0)
{
var _bottom = new IHTMLDiv();
_bottom.style.SetLocation(0, rs.Size.Y - 1 + rs.Bottom, rs.Size.X, YMax);
_bottom.AttachTo(Control);
_bottom.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;
for (int y = 0; y < YMax; y++)
{
CopyLineY(
new ReflectionFrameInfo
{
From = y,
To = YMax - y * 2,
Opacity = y / YMax,
Size = YMax,
Offset = 0,
Owner = _bottom
}
);
}
}
if (rs.Top >= 0)
{
var _top = new IHTMLDiv();
_top.style.SetLocation(0, -YMax - rs.Top, rs.Size.X, YMax);
_top.AttachTo(Control);
_top.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;
for (int y = 0; y < YMax; y++)
{
CopyLineY(
new ReflectionFrameInfo
{
From = y,
To = YMax - y * 2,
Opacity = (1 - (y / (YMax))),
//.........这里部分代码省略.........
示例9: 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(IDefault page)
{
@"Hello world".ToDocumentTitle();
var output = new IHTMLTextArea().AttachToDocument();
var gexf = new XElement("gexf");
gexf.Add(
new XElement("meta",
new XElement("creator", "jsc"),
new XElement("description", "NASDAQSNA")
)
);
var graph = new XElement("graph",
new XAttribute("mode", "static"),
new XAttribute("defaultedgetype", "directed")
);
gexf.Add(graph);
var nodes = new XElement("nodes");
graph.Add(nodes);
var edges = new XElement("edges");
graph.Add(edges);
output.value = gexf.ToString();
output.onfocus +=
delegate
{
output.value = gexf.ToString();
};
output.onmouseover +=
delegate
{
output.value = gexf.ToString();
};
var NumericNodeIdLookup = new List<string>();
Func<string, int> GetNumericNodeId =
k =>
{
if (!NumericNodeIdLookup.Contains(k))
NumericNodeIdLookup.Add(k);
return NumericNodeIdLookup.IndexOf(k);
};
#region AddRelatedCompanies
Func<IHTMLDiv, string, Action, Task> AddRelatedCompanies = null;
AddRelatedCompanies =
(c, qid, done) =>
{
var nqid = GetNumericNodeId(qid).ToString();
var cc = new IHTMLDiv();
cc.style.marginLeft = "2em";
var service = new ApplicationWebService
{
qid = qid,
yield = (id, CompanyName, Price) =>
{
var nid = GetNumericNodeId(id).ToString();
if (nodes.Elements().Any(k => k.Attribute("id").Name.LocalName == nid))
{
}
else
{
nodes.Add(
new XElement("node",
new XAttribute("id", nid),
new XAttribute("label", CompanyName)
)
);
}
var btn = new IHTMLButton
{
innerText = id + " " + CompanyName + " " + Price
};
btn.style.display = IStyle.DisplayEnum.block;
//.........这里部分代码省略.........
示例10: __Application
public void __Application(IApplicationLoader app)
{
//app.LoadingAnimation.FadeOut();
var DefaultTitle = "jsc solutions";
Native.Document.title = DefaultTitle;
StringActionAction GetTitleFromServer = new UltraWebService().GetTitleFromServer;
GetTitleFromServer(
n => Native.Document.title = n
);
var MyPagesBackground = new IHTMLDiv
{
};
MyPagesBackground.style.overflow = IStyle.OverflowEnum.hidden;
MyPagesBackground.style.position = IStyle.PositionEnum.absolute;
MyPagesBackground.style.width = "100%";
MyPagesBackground.style.height = "100%";
MyPagesBackground.AttachToDocument();
var MyPages = new IHTMLDiv
{
};
MyPages.style.overflow = IStyle.OverflowEnum.auto;
MyPages.style.position = IStyle.PositionEnum.absolute;
MyPages.style.width = "100%";
MyPages.style.height = "100%";
MyPages.AttachToDocument();
var MyPagesInternal = new IHTMLDiv();
MyPagesInternal.style.margin = "4em";
MyPagesInternal.AttachTo(MyPages);
// http://www.google.com/support/forum/p/Google+Analytics/thread?tid=486a963e463df665&hl=en
var gapathname = Native.Document.location.pathname;
var gasearch = Native.Document.location.search;
var gahash = Native.Window.escape(Native.Document.location.hash);
var gapageview = gapathname + gasearch + gahash;
var hash = Native.Document.location.hash;
Action<string> Analytics = delegate { };
#region logo
{
var IsStudio = Native.Document.location.hash.StartsWith("#/studio");
if (Native.Document.location.host.StartsWith("studio."))
{
IsStudio = true;
}
if (IsStudio)
{
new StudioView(AddSaveButton).Content.AttachToDocument();
}
else if (Native.Document.location.hash.StartsWith("#/docs"))
{
var view = new DocumentationCompilationViewer();
view.TouchTypeSelected +=
type =>
{
Native.Document.location.hash = "#/docs/" + type.FullName;
Analytics("#/docs/" + type.FullName);
};
}
else if (Native.Document.location.hash.StartsWith("#/warehouse"))
{
new UltraWebService().ThreeDWarehouse(
y =>
{
Func<string, IHTMLAnchor> Build =
mid =>
{
var a = new IHTMLAnchor { href = "http://sketchup.google.com/3dwarehouse/details?ct=hppm&mid=" + mid }.AttachTo(MyPagesInternal);
var img = new IHTMLImage { src = "http://sketchup.google.com/3dwarehouse/download?rtyp=st&ctyp=other&mid=" + mid }.AttachTo(a);
return a;
};
var imgs = Enumerable.ToArray(
from k in y.Elements()
select Build(k.Value)
);
}
//.........这里部分代码省略.........
示例11: AddDropDownOptions
public static IHTMLDiv AddDropDownOptions(this TextBox that, params object[] e)
{
var x = new IHTMLDiv();
x.style.backgroundColor = "rgba(255,255,255,1.0)";
x.style.position = IStyle.PositionEnum.absolute;
x.style.height = "auto";
x.style.width = "100%";
x.style.top = "100%";
x.style.zIndex = 999;
var c = that.GetHTMLTarget();
x.AttachTo(c);
x.Hide();
that.GotFocus += delegate
{
x.Show();
};
that.Leave += delegate
{
x.Hide();
};
e.AsEnumerable().WithEach(
k =>
{
{
//var o = k as UserControl;
var o = k as Control;
if (o != null)
{
o.BackColor = Color.Transparent;
o.GetHTMLTarget().With(
div =>
{
div.AttachTo(x);
div.style.width = "auto";
div.style.position = IStyle.PositionEnum.relative;
}
);
return;
}
}
{
var o = (INodeConvertible<IHTMLDiv>)k;
{
o.AttachTo(x);
//o.div.css.hover.style.backgroundColor = "yellow";
}
}
}
);
return x;
}
示例12: RenderWriteHistory
private void RenderWriteHistory(Dictionary<SolutionFileTextFragment, Color> Lookup, SolutionFile f, IHTMLElement Container)
{
Func<SolutionFileTextFragment, Color> LookupOrDefault =
ff =>
{
if (this.Colors.ContainsKey(ff))
return this.Colors[ff];
return this.Colors[SolutionFileTextFragment.None];
};
var Content = new IHTMLDiv().AttachTo(Container);
Content.style.position = IStyle.PositionEnum.relative;
var ViewBackground = new IHTMLDiv().AttachTo(Content);
ViewBackground.style.position = IStyle.PositionEnum.absolute;
ViewBackground.style.left = "0px";
ViewBackground.style.top = "0px";
ViewBackground.style.width = "4em";
ViewBackground.style.borderRight = "1px dotted gray";
ViewBackground.style.paddingRight = "0.5em";
var ViewTrap = new IHTMLDiv().AttachTo(Content);
ViewTrap.style.position = IStyle.PositionEnum.absolute;
ViewTrap.style.left = "0px";
ViewTrap.style.top = "0px";
ViewTrap.style.right = "0px";
ViewTrap.style.bottom = "0px";
//ViewTrap.style.backgroundColor = Color.White;
var ViewTrapContainer = new IHTMLDiv().AttachTo(ViewTrap);
ViewTrapContainer.style.cursor = IStyle.CursorEnum.text;
ViewTrapContainer.style.position = IStyle.PositionEnum.relative;
ViewTrapContainer.style.paddingLeft = "5em";
var View = new IHTMLDiv().AttachTo(ViewTrapContainer);
var ContentHeightDummy = new IHTMLDiv().AttachTo(Content);
var RegionStack = new Stack<List<Action<bool>>>();
var RegionGlobal = new List<Action<bool>>();
RegionStack.Push(RegionGlobal);
var Lines = new List<IHTMLDiv>();
var CurrentLineDirty = false;
var CurrentLine = default(IHTMLDiv);
var CurrentLineContent = default(IHTMLDiv);
Action NextLine = delegate
{
CurrentLineDirty = false;
var c = new IHTMLDiv();
var cc = new IHTMLDiv();
var cb = new IHTMLDiv();
CurrentLine = c.AttachTo(View);
CurrentLineContent = cc.AttachTo(c);
var CurrentRegion = RegionStack.Peek();
RegionStack.WithEach(
k =>
{
k.Add(
IsActive =>
{
// should we react when in a global region
if (k == RegionGlobal)
return;
if (IsActive)
{
cc.style.backgroundColor = Color.FromGray(0xf9);
cb.style.backgroundColor = Color.FromGray(0xf9);
}
else
{
cc.style.backgroundColor = Color.None;
cb.style.backgroundColor = Color.None;
}
}
);
}
);
CurrentLine.onmouseover +=
delegate
{
CurrentRegion.Invoke(true);
cc.style.backgroundColor = Color.FromGray(0xf0);
cb.style.backgroundColor = Color.FromGray(0xf0);
//.........这里部分代码省略.........
示例13: CreateRotor
private static void CreateRotor(double _angle, IHTMLElement _container)
{
var shadow = new IHTMLDiv();
shadow.style.position = IStyle.PositionEnum.absolute;
shadow.style.left = "0px";
shadow.style.top = "0px";
shadow.style.width = "600px";
shadow.style.height = "400px";
shadow.style.backgroundColor = "black";
shadow.style.Opacity = 0.3;
shadow.AttachTo(_container);
var borders = new IHTMLDiv();
borders.style.position = IStyle.PositionEnum.absolute;
borders.style.left = "0px";
borders.style.top = "0px";
//borders.style.width = "400px";
//borders.style.height = "300px";
borders.style.border = "4px solid black";
borders.style.Opacity = 0.1;
borders.AttachTo(_container);
var a = new IHTMLDiv();
// we can specify rotation origin within red area!
a.style.backgroundColor = "red";
a.style.marginTop = "-200px";
a.style.marginLeft = "-300px";
a.style.paddingLeft = "300px";
a.style.paddingTop = "200px";
var c = new IHTMLDiv();
var z = new IHTMLButton("hi");
z.AttachTo(c);
c.AttachTo(a);
//a.style.width = "300px";
//a.style.height = "200px";
c.style.width = "300px";
c.style.height = "200px";
//c.style.position = IStyle.PositionEnum.relative;
//c.style.SetLocation(0, 0);
//c.style.clip = "rect(0px,60px,200px,0px)";
c.appendChild("hello world");
c.appendChild(new IHTMLButton("click me"));
var xx = new IHTMLButton("xx");
xx.style.SetLocation(32, 32);
c.appendChild(xx);
c.appendChild("hello world");
new IHTMLDiv
{
innerText =
@"As it seems we can use apng files but
we cannot have absolute children. This means we will be able to support
non container objects."
}.AttachTo(c);
c.style.SetBackground("assets/MatrixTransformExample/bg.png", true);
var t = new IHTMLDiv();
c.appendChild(t);
//a.style.width = "400px";
//a.style.height = "300px";
var angle = _angle;
ApplyRotation2(a, angle, 1, 200, 0);
new Timer(
delegate
{
t.innerHTML = "" + angle;
angle -= 2;
ApplyRotation2(a, angle, 1, 200, 0);
borders.style.SetSize(a.offsetWidth, a.offsetHeight);
borders.style.SetLocation((a.clientWidth - a.offsetWidth) / 2, (a.clientHeight - a.offsetHeight) / 2);
a.style.SetLocation((a.clientWidth - a.offsetWidth) / 2, (a.clientHeight - a.offsetHeight) / 2);
}
, 0, 250
);
//.........这里部分代码省略.........
示例14: ExposedFunctions_AddData1
public static void ExposedFunctions_AddData1(Data1 e)
{
if (e == null)
{
new IHTMLDiv { innerText = "yay, no data..." }.AttachTo(instructions);
return;
}
Func<string> GetString = () => new { e.text, e.index }.ToString();
// this function can now be used by external API
e.GetString = IFunction.OfDelegate(GetString);
var div = new IHTMLDiv
{
// using a real anonymous type, we get a nice key value string for display
innerText = GetString()
};
#region attach events
if (e.onclick != null)
{
div.style.cursor = IStyle.CursorEnum.pointer;
div.onclick +=
delegate
{
e.onclick.apply(e, div);
};
}
if (e.onmouseover != null)
{
div.style.cursor = IStyle.CursorEnum.pointer;
div.onmouseover +=
delegate
{
e.onmouseover.apply(e, div);
};
}
if (e.onmouseout != null)
{
div.style.cursor = IStyle.CursorEnum.pointer;
div.onmouseout +=
delegate
{
e.onmouseout.apply(e, div);
};
}
#endregion
div.AttachTo(instructions);
}
示例15: __SplitContainer
public __SplitContainer()
{
//InternalElement.style.backgroundColor = "red";
this.Panel1 = new SplitterPanel(this);
this.Panel2 = new SplitterPanel(this);
this.Controls.Add(this.Panel1);
this.Controls.Add(this.Panel2);
var TheSplitter = new IHTMLDiv { };
TheSplitter.css.hover.style.backgroundColor = "blue";
TheSplitter.css.active.style.backgroundColor = "blue";
TheSplitter.style.cursor = DOM.IStyle.CursorEnum.move;
TheSplitter.AttachTo(
InternalElement
);
this.SplitterDistance = 200;
var h = new DragHelper(TheSplitter);
h.Enabled = true;
//h.Position.X = this.SplitterDistance;
h.DragMove +=
delegate
{
//this.SplitterDistance = h.Position.X;
if (this.InternalOrientation == global::System.Windows.Forms.Orientation.Horizontal)
{
TheSplitter.style.SetLocation(0, h.Position.Y);
}
else
{
TheSplitter.style.SetLocation(h.Position.X, 0);
}
};
// X:\jsc.svn\examples\javascript\forms\FormsSplitter\FormsSplitter\ApplicationControl.cs
TheSplitter.style.position = DOM.IStyle.PositionEnum.absolute;
Action AtUpdate = delegate
{
__Panel p1 = this.Panel1;
__Panel p2 = this.Panel2;
if (this.InternalOrientation == global::System.Windows.Forms.Orientation.Horizontal)
{
h.Position.Y = this.SplitterDistance;
p1.InternalElement.style.position = DOM.IStyle.PositionEnum.absolute;
p1.InternalElement.style.left = "0px";
p1.InternalElement.style.top = "0px";
p1.InternalElement.style.width = "";
p1.InternalElement.style.bottom = "";
p1.InternalElement.style.right = "0px";
p1.InternalElement.style.height = (this.SplitterDistance - 4) + "px";
p2.InternalElement.style.position = DOM.IStyle.PositionEnum.absolute;
p2.InternalElement.style.left = "0px";
p2.InternalElement.style.top = (this.SplitterDistance + 4) + "px";
p2.InternalElement.style.width = "";
p2.InternalElement.style.bottom = "0px";
p2.InternalElement.style.right = "0px";
p2.InternalElement.style.height = "";
TheSplitter.style.left = "0px";
TheSplitter.style.top = (this.SplitterDistance - 4) + "px";
TheSplitter.style.right = "0px";
TheSplitter.style.height = "8px";
TheSplitter.style.width = "";
TheSplitter.style.bottom = "";
//.........这里部分代码省略.........