本文整理汇总了C#中System.Windows.Forms.Form.GetHTMLTarget方法的典型用法代码示例。如果您正苦于以下问题:C# Form.GetHTMLTarget方法的具体用法?C# Form.GetHTMLTarget怎么用?C# Form.GetHTMLTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.GetHTMLTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeSidebarBehaviour
// advertise in ScriptCoreLib.Extensions
public static global::CSSMinimizeFormToSidebar.HTML.Pages.IApp InitializeSidebarBehaviour(
Form f,
bool HandleClosed = true,
bool HandleDragToLeft = true)
{
// can we do a dynamic upgrade?
var newlayout = new global::CSSMinimizeFormToSidebar.HTML.Pages.App();
newlayout.AddMoreText.Hide();
var newlayoutnodes = newlayout.body.childNodes.ToArray();
//newlayout.Sidebar.name = "Sidebar";
// where is this guy??
//newlayout.SidebarOverlay.name = "SidebarOverlay";
var oldcontent = Native.document.body.childNodes.ToArray();
Native.Document.body.Clear();
Native.Document.body.appendChild(newlayoutnodes);
Native.Document.body.setAttribute("style",
newlayout.Container.getAttribute("style")
);
var mycontainer = new IHTMLDiv().AttachTo((IHTMLElement)newlayout.ScrollContainer.parentNode);
newlayout.ScrollContainer.Orphanize();
mycontainer.style.position = IStyle.PositionEnum.absolute;
mycontainer.style.left = "10em";
mycontainer.style.top = "0px";
mycontainer.style.right = "0px";
mycontainer.style.bottom = "0px";
mycontainer.appendChild(oldcontent);
//Native.Document.body.Orphanize();
//newlayout.Container.AttachTo(Native.Document.documentElement);
//Native.Document.body = (IHTMLBody)(object)newlayout.Container;
// reparent
f.GetHTMLTarget().Orphanize().AttachToDocument();
global::CSSMinimizeFormToSidebar.ApplicationExtension.InitializeSidebarBehaviour(
newlayout, f, HandleClosed: HandleClosed, HandleDragToLeft: HandleDragToLeft
);
return newlayout;
}
示例2: 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\DynamicStylePerspective\DynamicStylePerspective\Application.cs
// X:\jsc.svn\examples\javascript\css\Test\TestPerspectiveInShadow\TestPerspectiveInShadow\Application.cs
// x:\jsc.svn\examples\javascript\css\test\testperspectiveinshadow\testperspectiveinshadow\design\shadowlayout.htm
// forms has some effects defined.
// for special css3d effects we want shadow dom
// but lets not used shadowdom from forms just yet as it removes other browsers
var f = new Form();
// X:\jsc.svn\examples\javascript\chrome\apps\ChromeNexus7\ChromeNexus7\Application.cs
// this seems to cause <webview> to render only white. cannot used together for now?
f.GetHTMLTarget().shadow.With(
async shadow =>
{
var s = new ShadowLayoutManual().AttachTo(shadow);
s.content.setAttribute("state", "animateout");
//var s = new ShadowLayout().AttachTo(shadow);
// shadow content needs to be boxed to the same size the element thinks
// it has!
s.content.style.SetSize(f.Width, f.Height);
f.SizeChanged +=
delegate
{
s.content.style.SetSize(f.Width, f.Height);
};
await Native.window.async.onframe;
s.content.setAttribute("state", "animatein");
}
);
f.Show();
}
示例3: ToForm
public static Form ToForm(this XElement xml)
{
var f = new Form
{
Text = "SQL results"
};
var g = new DataGridView();
g.Dock = DockStyle.Fill;
f.Controls.Add(g);
g.Show();
g.Columns.AddRange(
xml.Element("th").Elements().Select(
td => new DataGridViewTextBoxColumn { HeaderText = td.Value + " " + td.Attribute("title").Value }
).ToArray()
);
g.Rows.AddRange(
xml.Elements("tr").Select(
tr =>
new DataGridViewRow().With(
r =>
{
r.Cells.AddTextRange(
tr.Elements().Select(td => td.Value).ToArray()
);
}
)
).ToArray()
);
f.Show();
f.GetHTMLTarget().AttachTo(Native.Document.body.parentNode);
return f;
}
示例4: GooApplication
public GooApplication(IGoo goopage, HistoryScope<ApplicationState> gooscope)
{
// init state! this will be sent to server at every new web call.
this.state = gooscope.state;
FlashTitle();
Native.document.title = state.title;
Native.document.body.style.borderTop = "1em red solid";
Action ShowDataTable =
delegate
{
goopage.output.Clear();
var f = new Form
{
Text = new { this.state.data.TableName }.ToString(),
ControlBox = false,
ShowIcon = false,
//WindowState = FormWindowState.Maximized
};
new DataGridView
{
// script: error JSC1000: No implementation found for this native method, please implement [System.Windows.Forms.DataGridView.set_BorderStyle(System.Windows.Forms.BorderStyle)]
//BorderStyle = BorderStyle.Fixed3D
//AutoSize = true,
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells,
DataSource = this.state.data,
Dock = DockStyle.Fill
}.AttachTo(f);
// do we need this?
f.GetHTMLTarget().AttachTo(goopage.output);
f.Show();
f.WindowState = FormWindowState.Maximized;
f.PopupInsteadOfClosing(
HandleFormClosing: false
// ,
// does not play well with maximized yet
//SpecialNoMovement: true
);
};
if (this.state.data == null)
{
// can we remove this from history then?
new IHTMLButton { innerText = "a page reload makes us forget DataTable. go back and get new data!" }.AttachTo(goopage.output).WhenClicked(
delegate
{
Native.window.history.back();
}
);
new IHTMLBreak().AttachTo(goopage.output);
new IHTMLButton { innerText = "or get new data, if the server is available" }.AttachTo(goopage.output).WhenClicked(
async delegate
{
Native.document.body.style.borderTop = "1em black solid";
this.reason = "page reload makes us forget DataTable";
//this.state = (await this.DoEnterData()).state;
var x = await this.DoEnterData();
this.state = x.state;
Native.document.body.style.borderTop = "1em red solid";
ShowDataTable();
}
);
}
else
{
ShowDataTable();
}
#region undo
gooscope.With(
async delegate
{
await gooscope;
// time to undo
Native.document.body.style.borderTop = "0.3em yellow solid";
}
//.........这里部分代码省略.........
示例5: ApplicationContent
public ApplicationContent(
IApp page,
Abstractatech.JavaScript.FileStorage.IApplicationWebServiceX service,
bool DisableBackground = false
)
{
FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;
if (!DisableBackground)
{
#region I want animated background!
WebGLClouds.Application.Loaded +=
a =>
{
Native.Document.body.parentNode.insertBefore(
a.container.Orphanize(),
Native.Document.body
);
a.container.style.position = [email protected];
};
new WebGLClouds.Application();
#endregion
}
//var minsize = new IHTMLDiv().AttachToDocument();
//minsize.style.SetSize(4000, 2000);
var f = new Form
{
Text = "My Files",
StartPosition = FormStartPosition.Manual,
SizeGripStyle = SizeGripStyle.Hide
};
#region w
var ff = new Form
{
StartPosition = FormStartPosition.Manual,
SizeGripStyle = SizeGripStyle.Hide
};
var w = new WebBrowser
{
Dock = DockStyle.Fill
}.AttachTo(ff);
w.GetHTMLTarget().name = "view";
w.Navigating +=
delegate
{
ff.Text = "Navigating";
if (Native.window.Width < 1024)
// docked?
if (ff.GetHTMLTarget().parentNode != null)
Native.window.scrollTo(ff.Left - 8, ff.Top - 8, TimeSpan.FromMilliseconds(300));
};
w.Navigated +=
delegate
{
if (w.Url.ToString() == "about:blank")
{
Native.window.scrollTo(0, 0, TimeSpan.FromMilliseconds(200));
ff.Text = "...";
"Web Files".ToDocumentTitle();
return;
}
//ff.Text = w.DocumentTitle;
ff.Text = Native.window.unescape(
w.Url.ToString().SkipUntilLastIfAny("/").TakeUntilLastIfAny(".")
);
ff.Text.ToDocumentTitle();
};
ff.FormClosing +=
//.........这里部分代码省略.........
示例6: MatrixTransformBExample
//.........这里部分代码省略.........
M12, M22,
0, 0
//0.838670551776886,0.5446390509605408,-0.5446390509605408,0.838670551776886,0,0
};
var code = @"
q.style.filter = ""progid:DXImageTransform.Microsoft.Matrix(M11='"" + m[0] + ""',M12='"" + m[2] + ""',M21='"" + m[1] + ""', M22='"" + m[3] + ""', sizingmethod='auto expand');"";
q.style.MozTransform = ""matrix("" + m[0] + "","" + m[1] + "","" + m[2] + "","" + m[3] + "","" + m[4] + "","" + m[5] + "")"";
q.style.WebkitTransform = ""matrix("" + m[0] + "","" + m[1] + "","" + m[2] + "","" + m[3] + "","" + m[4] + "","" + m[5] + "")"";
";
new IFunction("q", "m", code).apply(null, r_matrix, mm);
new IFunction("q", "m", code).apply(null, ro_matrix, mm);
var r_matrix_adj_x = (r_matrix.clientWidth - r_matrix.offsetWidth) / 2;
var r_matrix_adj_y = (r_matrix.clientHeight - r_matrix.offsetHeight) / 2;
var ro_matrix_adj_x = (ro_matrix.clientWidth - ro_matrix.offsetWidth) / 2;
var ro_matrix_adj_y = (ro_matrix.clientHeight - ro_matrix.offsetHeight) / 2;
r_matrix.style.SetLocation(x + r_matrix_adj_x, y + r_matrix_adj_y/*, w, h*/);
ro_matrix.style.SetLocation(x + InteractiveSetOrigin_x + ro_matrix_adj_x, y + InteractiveSetOrigin_y + ro_matrix_adj_y/*, w, h*/);
};
#region bind InteractiveSetRotation
at.onclick +=
e =>
{
InteractiveSetRotation(e.OffsetX, e.OffsetY);
};
at.onmousemove +=
e =>
{
InteractiveSetRotation(e.OffsetX, e.OffsetY);
};
at.onmouseover +=
delegate
{
info.innerText = "Click to set rotation";
};
InteractiveSetRotation(0, 0);
#endregion
#region bind InteractiveSetOrigin
m.ButtonClear.Click +=
delegate
{
InteractiveSetOrigin(0, 0);
};
r.onclick +=
e =>
{
// 0 0 is top left
InteractiveSetOrigin(-e.OffsetX, -e.OffsetY);
};
r.onmouseover +=
delegate
{
if (m.Debug1.Checked)
{
info.innerText = "Click to set padding";
return;
}
info.innerText = "Click to set origin";
};
#endregion
//InteractiveSetOrigin(0, 0);
InteractiveSetOrigin(-w / 2, -h / 2);
var f = new Form { Text = "MatrixModifier" };
m.BackColor = System.Drawing.Color.White;
f.Controls.Add(m);
f.ClientSize = m.Size;
f.GetHTMLTarget().AttachToDocument();
}
示例7: Application
//.........这里部分代码省略.........
);
}
#endregion
#region files
evt.dataTransfer.files.AsEnumerable().WithEachIndex(
(f, index) =>
{
Console.WriteLine(
new
{
f.name,
f.size,
f.lastModifiedDate
}
);
var ff = new Form();
ff.PopupInsteadOfClosing(HandleFormClosing: false);
ff.Text = new { f.type, f.name, f.size }.ToString();
ff.Show();
ff.MoveTo(
evt.CursorX + 32 * index,
evt.CursorY + 24 * index
);
var fc = ff.GetHTMLTargetContainer();
fc.title = ff.Text;
#region image
var i = default(IHTMLImage);
if (f.type.StartsWith("image/"))
{
// um would we have a timing issue here?
f.ToDataURLAsync(
src =>
{
i = new IHTMLImage { src = src }.AttachTo(fc);
i.style.width = "100%";
i.InvokeOnComplete(
delegate
{
ff.ClientSize = new System.Drawing.Size(
// keep it reasonable!
i.width.Min(600),
i.height.Min(400)
);
}
);
}
);
}
#endregion
示例8: 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)
{
//FormStyler.AtFormCreated = FormStyler.LikeWindows3;
// http://alteredqualia.com/css-shaders/sphere_simple.html
SphereRule.InitializeSphereRuleFor("shader");
Func<Form> q = delegate
{
var f =
//new Form1
new Form { Text = "CSS filter shader" };
f.SizeTo(512, 512);
f.Show();
f.GetHTMLTarget().className = "shader";
#region WhileDragging
Native.window.onframe += delegate
{
if (f.Capture)
{
f.GetHTMLTarget().className = "";
f.Text = "CSS filter shader (dragging)";
}
else
{
f.GetHTMLTarget().className = "shader";
f.Text = "CSS filter shader";
}
};
#endregion
return f;
};
q().MoveTo(32, 32);
FormStyler.AtFormCreated = FormStyler.LikeVisualStudioMetro;
q().MoveTo(96, 96);
FormStyler.AtFormCreated = FormStyler.LikeWindows3;
var pf = q();
}
示例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(IApp page)
{
GrayScaleRule.InitializeGrayScaleFor("CLRForm");
#region AddCLRForm
Func<Form> AddCLRForm = delegate
{
var f = new Form();
f.GetHTMLTarget().className = "CLRForm";
f.Text = "CSS filter shader";
#region WhileDragging
Native.window.requestAnimationFrame +=
delegate
{
if (f.Capture)
{
f.GetHTMLTarget().className = "";
f.Text = "CSS filter shader (dragging)";
}
else
{
f.GetHTMLTarget().className = "CLRForm";
f.Text = "CSS filter shader";
}
};
#endregion
var i = new WebBrowser
{
//Url = new Uri("/jsc"),
Dock = DockStyle.Fill
};
i.AttachTo(f);
f.Show();
i.Navigate("/jsc");
return f;
};
#endregion
AddCLRForm().MoveBy(0, 0);
FormStyler.AtFormCreated = FormStyler.LikeVisualStudioMetro;
AddCLRForm().MoveBy(32, 16);
FormStyler.AtFormCreated =
s =>
{
FormStyler.LikeVisualStudioMetro(s);
s.TargetOuterBorder.style.borderColor = ScriptCoreLib.JavaScript.Runtime.JSColor.Red;
s.Caption.style.backgroundColor = ScriptCoreLib.JavaScript.Runtime.JSColor.Red;
s.TargetOuterBorder.style.boxShadow = "rgba(255, 0, 0, 0.3) 0px 0px 6px 3px";
};
AddCLRForm().MoveBy(64, 32);
//f.GotFocus +=
// delegate
// {
// f.Text = "GotFocus";
// };
//f.LostFocus +=
// delegate
// {
// f.Text = "LostFocus";
// };
@"Hello world".ToDocumentTitle();
// Send data from JavaScript to the server tier
service.WebMethod2(
@"A string from JavaScript.",
value => value.ToDocumentTitle()
);
}
示例10: InitializeContent
// dynamic does not work in static yet?
//static
void InitializeContent()
{
// script: error JSC1000: Method: InitializeContent, Type: CSSTransform3DFPSExperimentByKeith.Application; emmiting failed : System.InvalidOperationException: unsupported flow detected, try to simplify.
// Assembly V:\CSSTransform3DFPSExperimentByKeith.Application.exe
// DeclaringType CSSTransform3DFPSExperimentByKeith.Application, CSSTransform3DFPSExperimentByKeith.Application, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null
// OwnerMethod InitializeContent
// Offset 00a0
// .Try ommiting the return, break or continue instruction.
// at jsc.Script.CompilerBase.BreakToDebugger(String e) in x:\jsc.internal.svn\compiler\jsc\Languages\CompilerBase.cs:line 266
// at jsc.ILBlock.PrestatementBlock.AddPrestatement(Prestatement p) in x:\jsc.internal.svn\compiler\jsc\CodeModel\ILBlock.cs:line 1654
// at jsc.ILBlock.PrestatementBlock.Populate(ILInstruction First, ILInstruction Last) in x:\jsc.internal.svn\compiler\jsc\CodeModel\ILBlock.cs:line 1606
// at jsc.ILBlock.PrestatementBlock.Populate() in x:\jsc.internal.svn\compiler\jsc\CodeModel\ILBlock.cs:line 1433
// at jsc.ILBlock.get_Prestatements() in x:\jsc.internal.svn\compiler\jsc\CodeModel\ILBlock.cs:line 1759
// at jsc.Languages.JavaScript.MethodBodyOptimizer.TryOptimize(IdentWriter w, ILBlock xb) in x:\jsc.internal.svn\compiler\jsc\Languages\JavaScript\MethodBodyOptimizer.cs:line 89
// at jsc.IL2Script.EmitBody(IdentWriter w, MethodBase SourceMethod, Boolean define_self) in x:\jsc.internal.svn\compiler\jsc\Languages\JavaScript\IL2Script.cs:line 576
//Unhandled Exception: System.InvalidOperationException: Method: InitializeContent, Type: CSSTransform3DFPSExperimentByKeith.Application; emmiting failed : System.InvalidOperationException: unsupported flow detected, try to simplify.
//dynamic window = Native.Window;
//dynamic __osxPlane = window.__osxPlane;
//IHTMLDiv __osxPlane_node = __osxPlane.node;
var discover = new IHTMLIFrame
{
//border = "0",
src = "http://discover.xavalon.net",
allowFullScreen = true,
frameBorder = "0"
};
//discover.style.transform = "scale(0.5)";
//discover.style.transformOrigin = "0% 0%";
//var scale = 1.25;
var scale = 1;
var zoom = 8;
discover.style.transform = "scale(" + (1 / scale) + ")";
discover.style.transformOrigin = "0% 0%";
discover.style.SetSize(
(int)(__wall_c.clientWidth * zoom * scale),
(int)(__wall_c.clientHeight * zoom * scale)
);
//dynamic ds = discover.style;
//ds.zoom = (100.0 / zoom) + "%";
discover.AttachTo(__wall_c);
var c = new Controls.UserControl1();
c.GetHTMLTarget().className = "nolock";
#region button1
c.button1.Click +=
delegate
{
var cf = new Form1();
cf.Show();
cf.FormClosing +=
(ss, ee) =>
{
if (cf.WindowState == FormWindowState.Normal)
{
if (ee.CloseReason == CloseReason.UserClosing)
{
ee.Cancel = true;
cf.WindowState = FormWindowState.Minimized;
}
}
};
cf.GetHTMLTarget().className = "nolock";
};
#endregion
#region button2
c.button2.Click +=
delegate
{
var cf = new Form();
var cw = new WebBrowser { Dock = DockStyle.Fill };
cf.Controls.Add(cw);
cw.Navigate(
"http://discover.xavalon.net"
//.........这里部分代码省略.........
示例11: InitializeContent
//.........这里部分代码省略.........
world.addPlane(new Plane(colour, w, d, x, y, z, 90, 0, 0));
world.addPlane(new Plane(colour, d, h, x, y, z, 0, 270, 0));
world.addPlane(new Plane(colour, d, h, x + w, y, z + d, 0, 90, 0));
world.addPlane(new Plane(colour, w, d, x + w, y + h, z, 90, 180, 0));
world.addPlane(new Plane(colour, w, h, x, y, z + d, 0, 0, 0));
};
buildCube0("url(assets/CSSTransform3DFPSExperiment/desk.jpg)", 10, 50, 300, -150 + 400, 345, -250, 0, 0, 0);
for (int xi = 0; xi < 20; xi++)
{
buildCube("url(assets/CSSTransform3DFPSExperiment/desk.jpg)", 10, 50, 300, -150 + 400, 345 + 60 * xi, -250, 0, 0, 0);
}
new Plane(
"url(assets/CSSTransform3DFPSExperiment/wood.jpg)", 800, 800, -400 + 800, 400, 53, 180, 0, 0
).With(
pp =>
{
world.addPlane(pp);
pp.position.x += 20;
//pp.rotation.z += 15;
pp.update();
}
);
c.GetHTMLTarget().className = "nolock";
c.button1.Click +=
delegate
{
var cf = new Form1();
cf.Show();
cf.FormClosing +=
(ss, ee) =>
{
if (cf.WindowState == FormWindowState.Normal)
{
if (ee.CloseReason == CloseReason.UserClosing)
{
ee.Cancel = true;
cf.WindowState = FormWindowState.Minimized;
}
}
};
cf.GetHTMLTarget().className = "nolock";
};
c.button2.Click +=
delegate
{
var cf = new Form();
var cw = new WebBrowser { Dock = DockStyle.Fill };
示例12: 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)
{
var random = new Random();
device_id = random.Next();
#region con
var con = new ConsoleForm();
con.InitializeConsoleFormWriter();
con.StartPosition = FormStartPosition.Manual;
con.Show();
// make it slim
con.Height = 100;
// TopMost
con.GetHTMLTarget().style.zIndex = 20002;
con.Opacity = 0.9;
Action Toggle =
delegate
{
if (con.WindowState == FormWindowState.Minimized)
{
con.WindowState = FormWindowState.Normal;
}
else
{
con.WindowState = FormWindowState.Minimized;
}
// put the console far right bottom
con.MoveTo(
Native.window.Width - con.Width,
Native.window.Height - con.Height
);
};
Action<int> AtKeyCode =
KeyCode =>
{
Console.WriteLine(
new { KeyCode }
);
// US
if (KeyCode == 222)
{
Toggle();
}
// EE
if (KeyCode == 192)
{
Toggle();
}
};
#if onorientationchange
Native.window.onorientationchange +=
e =>
{
Toggle();
};
#endif
Native.document.onkeyup +=
e =>
{
AtKeyCode(e.KeyCode);
};
Toggle();
#endregion
Console.WriteLine("console ready for " + new { id = device_id });
var x = 0;
var y = 0;
#region Virtual Screen
FormStyler.AtFormCreated = LikeDesktop;
var fs = new Form { };
//fs.FormBorderStyle = FormBorderStyle.None;
//.........这里部分代码省略.........
示例13: 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)
{
DiagnosticsConsole.ApplicationContent.BindKeyboardToDiagnosticsConsole();
FormStyler.AtFormCreated =
s =>
{
FormStyler.LikeVisualStudioMetro(s);
s.TargetOuterBorder.style.borderColor = ScriptCoreLib.JavaScript.Runtime.JSColor.FromRGB(0, 127, 0);
s.Caption.style.backgroundColor = ScriptCoreLib.JavaScript.Runtime.JSColor.FromRGB(0, 127, 0);
s.TargetOuterBorder.style.boxShadow = "rgba(0, 127, 0, 0.3) 0px 0px 6px 3px";
};
//FormStyler.AtFormCreated = FormStyler.LikeWindows3;
var SidebarIdleWidth = 32;
var f = new Form { Text = "Sidebar" };
GrayScaleRule.InitializeGrayScaleFor("CLRForm");
f.GetHTMLTarget().className = "CLRForm";
#region WhileDragging
Action WhileDragging = null;
WhileDragging = delegate
{
if (f.Left == 0)
{
f.GetHTMLTarget().className = "CLRForm_nohover";
f.Text = "Sidebar (docked)";
}
else if (f.Capture)
{
f.GetHTMLTarget().className = "";
f.Text = "Sidebar (dragging)";
}
else
{
f.GetHTMLTarget().className = "CLRForm";
f.Text = "Sidebar";
}
Native.window.requestAnimationFrame += WhileDragging;
};
Native.window.requestAnimationFrame += WhileDragging;
#endregion
var c = new Sidebar { Dock = DockStyle.Fill }.AttachTo(f);
f.Show();
Action<int> SetLeftSidebarWidth =
w =>
{
page.SidebarContainer.style.width = w + "px";
page.DocumentContent.style.left = w + "px";
};
Action<int> SetRightSidebarWidth =
w =>
{
page.RightSidebarContainer.style.width = w + "px";
page.DocumentContent.style.right = w + "px";
};
#region LocationChanged
var LocationChangedDisabled = false;
f.LocationChanged +=
delegate
{
if (LocationChangedDisabled)
return;
if (f.Left == 0)
return;
if (f.Right == Native.window.Width)
return;
SetLeftSidebarWidth(SidebarIdleWidth);
SetRightSidebarWidth(SidebarIdleWidth);
if (f.Left < SidebarIdleWidth && c.checkBox1.Checked)
page.SidebarContainer.style.backgroundColor = JSColor.Blue;
else
page.SidebarContainer.style.backgroundColor = JSColor.Gray;
if (f.Right > Native.window.Width - SidebarIdleWidth && c.checkBox2.Checked)
page.RightSidebarContainer.style.backgroundColor = JSColor.Blue;
//.........这里部分代码省略.........
示例14: Application
/// <summary>
/// This is a javascript application.
/// </summary>
/// <param name="document">HTML document rendered by the web server which can now be enhanced.</param>
public Application(IApp document)
{
//
//document.body.AsXElement().Elements("script").Remove();
//document.body.AsXElement().Elements("script").WithEach(k => k.Remove());
var f = new Form { Text = "Visual Editor" };
f.PopupInsteadOfClosing(HandleFormClosing: true);
f.Width = 600;
var diagnostics = new IHTMLDiv().AttachTo(document.body.parentNode);
//var diagnostics = new IHTMLBody().AttachTo(Native.document.body.parentNode);
diagnostics.style.backgroundColor = "rgba(0, 0, 0, 0)";
diagnostics.style.position = IStyle.PositionEnum.absolute;
diagnostics.style.overflow = IStyle.OverflowEnum.hidden;
diagnostics.style.left = "0px";
diagnostics.style.top = "-100%";
diagnostics.style.width = "100%";
diagnostics.style.height = "100%";
f.Show();
f.GetHTMLTarget().AttachTo(diagnostics);
//Uncaught TypeError: Cannot call method 'write' of null
var editor = new TextEditor(f.GetHTMLTargetContainer());
var snd = new HTML.Audio.FromAssets.SAMPLES036();
snd.load();
var snd2 = new HTML.Audio.FromAssets.Hammertime();
snd2.load();
Action reverse = delegate { };
Action Hide =
delegate
{
//
(document.body.style as dynamic).webkitFilter = "";
diagnostics.style.top = "-100%";
diagnostics.style.backgroundColor = "rgba(0, 0, 0, 0)";
snd2.play();
snd2 = new HTML.Audio.FromAssets.Hammertime();
snd2.load();
reverse();
};
Action Show =
delegate
{
if (diagnostics.style.top != "-100%")
return;
// { -webkit-filter: grayscale(0.5) blur(10px);
(document.body.style as dynamic).webkitFilter = "grayscale(0.5) blur(2px)";
diagnostics.style.top = "0%";
diagnostics.style.backgroundColor = "rgba(0, 0, 0, 0.5)";
snd.play();
snd = new HTML.Audio.FromAssets.SAMPLES036();
snd.load();
// using undo context? save load and store ops to revert them
editor.InnerHTML = document.body.innerHTML;
reverse = delegate
{
document.body.innerHTML = editor.InnerHTML;
reverse = delegate { };
};
};
Hide();
// http://www.w3schools.com/css3/css3_transitions.asp
diagnostics.style.transition = "all 0.2s ease-in-out";
//.........这里部分代码省略.........
示例15: InitializeContent
//.........这里部分代码省略.........
f.Width * zoom,
f.Height * zoom,
10,
//0,
-f.Right * zoom, f.Top * zoom,
0 - f.Z * zoom + zz,
//-250,
0, 0, 0);
}
);
}
};
CreateFromFloorplan();
//zz += 300;
//CreateFromFloorplan();
#endregion
//avoid out of memory - elements will go missing
//zz += 300;
//CreateFromFloorplan();
c.GetHTMLTarget().className = "nolock";
c.button1.Click +=
delegate
{
var cf = new Form1();
cf.Show();
cf.FormClosing +=
(ss, ee) =>
{
if (cf.WindowState == FormWindowState.Normal)
{
if (ee.CloseReason == CloseReason.UserClosing)
{
ee.Cancel = true;
cf.WindowState = FormWindowState.Minimized;
}
}
};
cf.GetHTMLTarget().className = "nolock";
};
c.button2.Click +=
delegate
{
var cf = new Form();
var cw = new WebBrowser { Dock = DockStyle.Fill };