本文整理汇总了C#中System.Windows.Forms.Form.MoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# Form.MoveTo方法的具体用法?C# Form.MoveTo怎么用?C# Form.MoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.MoveTo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
//.........这里部分代码省略.........
ff.Show();
}
);
}
#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)
);
}
);
示例2: ApplicationContent
//.........这里部分代码省略.........
var content = f.GetHTMLTargetContainer();
var hh = new HorizontalSplit
{
Minimum = 0.05,
Maximum = 0.95,
Value = 0.4,
};
hh.Container.AttachToDocument();
hh.Container.style.position = IStyle.PositionEnum.absolute;
hh.Container.style.left = "0px";
hh.Container.style.top = "0px";
hh.Container.style.right = "0px";
hh.Container.style.bottom = "0px";
hh.Split.Splitter.style.backgroundColor = "rgba(0,0,0,0.0)";
#region AtResize
Action AtResize = delegate
{
Native.Document.getElementById("feedlyMiniIcon").Orphanize();
Native.Document.body.style.minWidth = "";
if (ff.GetHTMLTarget().parentNode == null)
{
Native.window.scrollTo(0, 0);
f.MoveTo(8, 8).SizeTo(Native.window.Width - 16, Native.window.Height - 16);
return;
}
if (f.GetHTMLTarget().parentNode == null)
{
Native.window.scrollTo(0, 0);
ff.MoveTo(8, 8).SizeTo(Native.window.Width - 16, Native.window.Height - 16);
return;
}
if (Native.window.Width < 1024)
{
Native.Document.body.style.minWidth = (Native.window.Width * 2) + "px";
f.MoveTo(8, 8).SizeTo(Native.window.Width - 16, Native.window.Height - 16);
ff.MoveTo(Native.window.Width + 8, 8).SizeTo(Native.window.Width - 16, Native.window.Height - 16);
// already scrolled...
if (w.Url.ToString() != "about:blank")
// docked?
if (ff.GetHTMLTarget().parentNode != null)
Native.window.scrollTo(ff.Left - 8, ff.Top - 8);
return;
}
示例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)
{
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;
//.........这里部分代码省略.........
示例4: InitializeContent
//.........这里部分代码省略.........
p.X += 16;
p.Y += 16;
}
};
#endregion
#region tutorial step 4
#region CreateDialogAt
var CreateDialogAt =
new
{
//Dialog = default(IHTMLDiv),
Content = default(IHTMLDiv),
Width = default(string)
}
.ToFunc(
(Point pos, string width) =>
{
var f = new Form();
f.Show();
f.SizeTo(200, 200);
// https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20151115/audio
//f.PopupInsteadOfClosing();
f.MoveTo(pos.X, pos.Y);
//f.SizeTo(
//var dialog = new IHTMLDiv();
//dialog.style.SetLocation(pos.X, pos.Y);
//dialog.style.backgroundColor = Color.Gray;
//dialog.style.padding = "1px";
//var caption = new IHTMLDiv().AttachTo(dialog);
//caption.style.backgroundColor = Color.Blue;
//caption.style.width = width;
//caption.style.height = "0.5em";
//caption.style.cursor = IStyle.CursorEnum.move;
//var drag = new DragHelper(caption);
//drag.Position = pos;
//drag.Enabled = true;
//drag.DragMove +=
// delegate
// {
// dialog.style.SetLocation(drag.Position.X, drag.Position.Y);
// };
var _content = new IHTMLDiv().AttachTo(f.GetHTMLTargetContainer());
_content.style.textAlign = IStyle.TextAlignEnum.center;
_content.style.backgroundColor = Color.White;
_content.style.padding = "1px";
示例5: InitializeSidebarBehaviour
// problems with roslyn build?
public static void InitializeSidebarBehaviour(
IApp page,
Form f,
bool HandleClosed = true,
bool HandleDragToLeft = true
)
{
var tt = f.GetHTMLTarget();
//page.SidebarInfo.style.tr
page.SidebarInfo.style.With(
(dynamic s) => s.webkitTransition = "all 0.3s linear"
);
var IsMinimized = false;
#region Minimize
Action Minimize =
delegate
{
if (IsMinimized)
return;
var t = tt;
dynamic style = t.style;
var old = new { f.Left, f.Top, f.Height };
// http://developer.apple.com/library/safari/documentation/AudioVideo/Reference/WebKitTransitionEventClassReference/WebKitTransitionEvent/WebKitTransitionEvent.html
var cleartransition = new ScriptCoreLib.JavaScript.Runtime.Timer(
delegate
{
style.webkitTransition = "";
style = null;
IsMinimized = false;
f.MoveTo(
old.Left.Max(page.Sidebar.clientWidth + 12)
, old.Top);
// prevent drawing artifacts
tt.style.transform = "";
}
);
Action DoRestore = null;
DoRestore = delegate
{
if (t == null)
return;
DoRestore = null;
Console.WriteLine("DoRestore");
style.webkitTransition = "all 0.3s linear";
t.style.transform = "scale(1)";
t.style.left = old.Left.Max(page.Sidebar.clientWidth + 12) + "px";
t.style.top = old.Top + "px";
//t.style.Opacity = 1;
f.Opacity = 1;
t = null;
page.SidebarInfo.style.marginTop = (0) + "px";
};
var clicktorestore = new ScriptCoreLib.JavaScript.Runtime.Timer(
delegate
{
style.webkitTransition = "";
page.SidebarOverlay.onclick +=
delegate
{
if (DoRestore != null)
DoRestore();
};
f.Resize +=
delegate
{
if (DoRestore != null)
DoRestore();
};
}
);
//.........这里部分代码省略.........
示例6: Application
//.........这里部分代码省略.........
// return;
//}
//if (f.GetHTMLTarget().parentNode == null)
//{
// Native.Window.scrollTo(0, 0);
// ff.MoveTo(8, 8).SizeTo(Native.Window.Width - 16, Native.Window.Height - 16);
// return;
//}
//if (Native.Window.Width < 1024)
//{
// Native.Document.body.style.minWidth = (Native.Window.Width * 2) + "px";
// f.MoveTo(8, 8).SizeTo(Native.Window.Width - 16, Native.Window.Height - 16);
// ff.MoveTo(Native.Window.Width + 8, 8).SizeTo(Native.Window.Width - 16, Native.Window.Height - 16);
// // already scrolled...
// if (w.Url.ToString() != "about:blank")
// // docked?
// if (ff.GetHTMLTarget().parentNode != null)
// Native.Window.scrollTo(ff.Left - 8, ff.Top - 8);
// return;
//}
f.MoveTo(16, 16).SizeTo(hh.LeftContainer.clientWidth - 32, Native.window.Height / 3 - 16 - 4);
f1.MoveTo(16, Native.window.Height / 3 + 4).SizeTo(hh.LeftContainer.clientWidth - 32, Native.window.Height / 3 - 8);
f2.MoveTo(16, Native.window.Height / 3 * 2 + 4).SizeTo(hh.LeftContainer.clientWidth - 32, Native.window.Height / 3 - 16);
ff.MoveTo(
Native.window.Width - hh.RightContainer.clientWidth + 16
, 16).SizeTo(hh.RightContainer.clientWidth - 32, Native.window.Height - 32);
//Console.WriteLine("LeftContainer " + new { hh.LeftContainer.clientWidth });
//Console.WriteLine("RightContainer " + new { hh.RightContainer.clientWidth });
};
hh.ValueChanged +=
delegate
{
AtResize();
};
Native.window.onresize +=
delegate
{
AtResize();
};
Native.window.requestAnimationFrame +=
delegate
{
AtResize();
};
#endregion
示例7: Application
//.........这里部分代码省略.........
// X:\jsc.svn\core\ScriptCoreLib.Windows.Forms\ScriptCoreLib.Windows.Forms\JavaScript\BCLImplementation\System\Windows\Forms\Form\Form..ctor.cs
//CaptionForeground.className = "caption";
// Could not load file or assembly 'ScriptCoreLib' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
var css = Native.css[typeof(Form)][" .caption"];
//var css = IStyleSheet.all[" .caption"];
//new IHTMLPre { new { css.rule.selectorText } }.AttachToDocument();
// https://code.google.com/p/chromium/issues/detail?id=229330
(css.style as dynamic).webkitAppRegion = "drag";
//(ff.CaptionForeground.style as dynamic).webkitAppRegion = "drag";
FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;
var ShadowRightBottom = 8;
var f = new Form
{
ShowIcon = false,
Text = Native.document.title,
//Text = Native.document.location.hash,
StartPosition = FormStartPosition.Manual
};
f.MoveTo(0, 0).SizeTo(
Native.window.Width - ShadowRightBottom,
Native.window.Height - ShadowRightBottom
);
//f.Opacity = 0.5;
f.Show();
var t = new TrackBar
{
Maximum = 100,
Minimum = 40,
Dock = DockStyle.Top
};
t.AttachTo(f);
t.ValueChanged += delegate
{
f.Opacity = (double)t.Value / (double)t.Maximum;
};
f.Opacity = 0.8;
var w = new WebBrowser
{
// this wont work?
//Dock = DockStyle.Fill
}.AttachTo(f);
示例8: Application
//.........这里部分代码省略.........
#region Capture
var tt = new ScriptCoreLib.JavaScript.Runtime.Timer();
Action AtCapture = null;
tt.Tick +=
delegate
{
if (LocationChangedDisabled)
return;
if (f.Left == 0)
return;
if (f.Right == Native.window.Width)
return;
if (f.Capture)
{
if (AtCapture != null)
AtCapture();
return;
}
if (f.Left < SidebarIdleWidth)
{
if (c.checkBox1.Checked)
{
var fs = f.Size;
SetLeftSidebarWidth(f.ClientSize.Width);
f.MoveTo(0, 0);
f.SizeTo(f.ClientSize.Width, page.SidebarContainer.clientHeight);
f.MinimumSize = new System.Drawing.Size(SidebarIdleWidth, Native.window.Height);
f.MaximumSize = new System.Drawing.Size(Native.window.Width - page.RightSidebarContainer.clientWidth, Native.window.Height);
var done = false;
Action<IEvent> onresize =
delegate
{
if (done)
return;
f.SizeTo(f.ClientSize.Width, page.SidebarContainer.clientHeight);
f.MinimumSize = new System.Drawing.Size(SidebarIdleWidth, Native.window.Height);
f.MaximumSize = new System.Drawing.Size(Native.window.Width - page.RightSidebarContainer.clientWidth, Native.window.Height);
};
Native.window.onresize += onresize;
AtCapture = delegate
{
done = true;
AtCapture = null;
f.MinimumSize = new System.Drawing.Size(100, 100);
f.SizeTo(fs.Width, fs.Height);
};
}
}
else if (f.Right > (Native.window.Width - SidebarIdleWidth))
{
示例9: Invoke
//.........这里部分代码省略.........
that.InternalElement = (IHTMLIFrame)(object)webview;
// src was not copied for some reason. force it.
that.Size = that.Size;
that.Refresh();
};
#endregion
var css = Native.css[typeof(Form)][" .caption"];
(css.style as dynamic).webkitAppRegion = "drag";
// FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;
// only if the host does alpha?
var ShadowRightBottom = 8;
#region Form
var f = new Form
{
ShowIcon = false,
Text = Native.document.title,
//Text = Native.document.location.hash,
StartPosition = FormStartPosition.Manual
};
f.MoveTo(0, 0).SizeTo(
Native.window.Width - ShadowRightBottom,
Native.window.Height - ShadowRightBottom
);
//f.Opacity = 0.5;
f.Show();
#endregion
var w = new WebBrowser
{
// this wont work?
//Dock = DockStyle.Fill
}.AttachTo(f);
w.Navigate(
Native.document.title
);
f.FormClosing +=
(sender, e) =>
{
// X:\jsc.svn\examples\javascript\chrome\apps\ChromeWebviewFullscreen\ChromeWebviewFullscreen\Application.cs
if (chrome.app.window.current().isFullscreen())
{
示例10: a
public a(IBeforeLogin ee)
{
//FormStyler.AtFormCreated = FormStyler.LikeVisualStudioMetro;
//FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;
var ff = new Form { FormBorderStyle = FormBorderStyle.None };
var ScrollArea = new App().ScrollArea.AttachTo(ff.GetHTMLTargetContainer());
//ScrollArea.style.backgroundColor = "#185D7B";
//ScrollArea.style.backgroundColor = "#185D7B";
ScrollArea.style.backgroundColor = "#105070";
var SidebarWidth = 172;
ff.MoveTo(SidebarWidth, 0);
Action AtResize = delegate
{
ff.SizeTo(Native.window.Width - SidebarWidth, Native.window.Height);
};
Native.window.onresize +=
delegate
{
AtResize();
};
AtResize();
var iii = global::CSSMinimizeFormToSidebar.ApplicationExtension.InitializeSidebarBehaviour(
ff,
// should be handle close instead!
HandleClosed: true,
HandleDragToLeft: false
);
iii.SidebarText.className = "AppPreviewText";
//iii.SidebarText.innerText = "My Appz";
//iii.SidebarText.innerText = "Synchronizing...";
//var finish = iii.SidebarText.ToASCIIStyledLoadAnimation("My Appz");
//Native.Document.body.style.backgroundColor = "#105070";
Native.document.body.style.backgroundColor = "#185D7B";
Native.window.onresize +=
delegate
{
// lets not centerize
//ff.Show();
};
//var page = new App();
//page.ScrollArea.AttachToDocument();
var count = 0;
var yield_BringToFront = false;
var icon_throttle = 0;
#region yield
yield_ACTION_MAIN yield = (
packageName,
name,
__IsCoreAndroidWebServiceActivity,
label
) =>
{
if (string.IsNullOrEmpty(label))
label = packageName;
var IsCoreAndroidWebServiceActivity = System.Convert.ToBoolean(__IsCoreAndroidWebServiceActivity);
count++;
var a = new AppPreview();
#region icon
if (packageName != "foo")
{
// see also: X:\jsc.svn\examples\javascript\ImageCachedIntoLocalStorageExperiment\ImageCachedIntoLocalStorageExperiment\Application.cs
// extension to the system
// data.icon[packageName].With
Action loadicon = delegate
{
new ScriptCoreLib.JavaScript.Runtime.Timer(
delegate
{
//.........这里部分代码省略.........
示例11: 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.AttachControlTo(page.Content);
//content.AutoSizeControlTo(page.ContentSize);
FormStyler.AtFormCreated = FormStylerLikeFloat.LikeFloat;
// I want animated background!
new WebGLClouds.Application();
//Native.Document.body.lastChild.MoveNodeToFirst();
var f = new Form();
content.BackColor = Color.Transparent;
content.Dock = DockStyle.Fill;
content.AttachTo(f);
f.Show();
@"Hello world".ToDocumentTitle();
// Send data from JavaScript to the server tier
service.WebMethod2(
@"A string from JavaScript.",
value => value.ToDocumentTitle()
);
Action ResizeMargin = delegate
{
if (f.GetHTMLTarget().parentNode == null)
Native.Document.body.style.marginLeft = 16 + "px";
else
Native.Document.body.style.marginLeft = (f.Width + 32) + "px";
};
Action AtResize = delegate
{
ResizeMargin();
f.MoveTo(16, 16);
f.SizeTo(
f.Width,
f.Height.Min(Native.window.Height - 32)
);
};
// why this not working?
//f.SizeChanged +=
content.ClientSizeChanged +=
delegate
{
ResizeMargin();
};
//new ScriptCoreLib.JavaScript.Runtime.Timer(
// delegate
// {
// }
//).StartInterval();
Native.window.onresize +=
delegate
{
AtResize();
};
AtResize();
f.PopupInsteadOfClosing(SpecialNoMovement: true);
}