本文整理汇总了C#中System.Windows.Forms.Form.SetDesktopLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Form.SetDesktopLocation方法的具体用法?C# Form.SetDesktopLocation怎么用?C# Form.SetDesktopLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.SetDesktopLocation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _Maximize
private void _Maximize(Form targetForm)
{
if (!_Fullscreen)
{
_Save(targetForm);
int ScreenNr = 0;
for (int i = 0; i < Screen.AllScreens.Length; i++)
{
Screen scr = Screen.AllScreens[i];
int midx = targetForm.Left + targetForm.Width / 2;
int midy = targetForm.Top + targetForm.Height / 2;
if (scr.Bounds.Top <= midy && scr.Bounds.Left <= midx && scr.Bounds.Bottom >= midy && scr.Bounds.Right >= midx)
ScreenNr = i;
}
targetForm.SetDesktopLocation(Screen.AllScreens[ScreenNr].Bounds.Left, Screen.AllScreens[ScreenNr].Bounds.Top);
targetForm.ClientSize = new Size(Screen.AllScreens[ScreenNr].Bounds.Width, Screen.AllScreens[ScreenNr].Bounds.Height);
targetForm.FormBorderStyle = FormBorderStyle.None;
_Fullscreen = true;
}
}
示例2: SetUpForm
/// <summary>
/// Position the form on the same monitor the user has put our app!
/// </summary>
/// <param name="f"></param>
public void SetUpForm(Form f)
{
Point desktop = this.DesktopLocation;
f.SetDesktopLocation(desktop.X + 100, desktop.Y + 100);
}
示例3: Form
void IProcessCallback.TraceMemory( int memoryBytes )
{
if( graphPictureBox == null || graphPictureBox.Parent == null ) {
Form form = new Form();
form.Owner = this;
form.Text = "Memory (Private Bytes)";
form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
form.ShowInTaskbar = false;
form.BackColor = Color.Black;
graphPictureBox = new PictureBox();
graphPictureBox.Size = form.ClientSize;
graphPictureBox.Image = new Bitmap( graphPictureBox.ClientSize.Width, graphPictureBox.ClientSize.Height );
using( Graphics g = Graphics.FromImage( graphPictureBox.Image ) ) {
for( int i = 1; i < 10; i++ ) {
int y = graphPictureBox.ClientSize.Height / 10 * i;
g.DrawLine( Pens.DarkGray, 0, y, graphPictureBox.ClientSize.Width, y );
}
}
form.Controls.Add( graphPictureBox );
form.Show();
form.SetDesktopLocation( this.DesktopLocation.X + Width, this.DesktopLocation.Y );
counter = 0;
prevValue = memoryBytes;
scale = (float)( graphPictureBox.ClientSize.Height ) / memoryBytes / 2;
return;
}
graphPictureBox.Parent.Show();
const int xScale = 3;
using( Graphics g = Graphics.FromImage( graphPictureBox.Image ) ) {
if( prevValue * scale > graphPictureBox.ClientSize.Height ) {
scale = (float)( graphPictureBox.ClientSize.Height ) / prevValue / 2;
g.DrawLine( Pens.DarkGray, xScale * counter, 0, xScale * counter, graphPictureBox.ClientSize.Height );
}
PointF prevPoint = new PointF( xScale * counter, graphPictureBox.ClientSize.Height - prevValue * scale );
prevValue = memoryBytes;
PointF newPoint = new PointF( xScale * ( counter + 1 ), graphPictureBox.ClientSize.Height - prevValue * scale );
g.DrawLine( Pens.Yellow, prevPoint, newPoint );
prevPoint = newPoint;
}
graphPictureBox.Invalidate();
counter++;
if( ( counter + 1 ) * xScale > graphPictureBox.ClientSize.Width ) {
counter = 0;
}
}
示例4: FireError
private void FireError(string pHost)
{
string error = "Something went wrong";
switch (WmiQueryTool.WmiResults.WmiError.HResult)
{
case -2147023174:
error = pHost + " " + WmiQueryTool.WmiResults.WmiError.Message.ToString() + "\r\n\r\nThe remote host is likely offline or having issues. Check remote IP and try again";
WmiQueryTool = null;
ScavengeStatus(pHost, false);
break;
case -2147023838:
error = pHost + " " + WmiQueryTool.WmiResults.WmiError.Message.ToString() + "\r\n\r\nThe Remote host appears to not be WMI capable. This can be caused by the WMI service being disabled, or the remote host not being a Windows system. Please validate remote host settings and try again";
WmiQueryTool = null;
ScavengeStatus(pHost, false);
break;
case -2147024891:
error = pHost + " " + WmiQueryTool.WmiResults.WmiError.Message.ToString() + "\r\n\r\nYour currently logged on user does not appear to have rights on the remote system. Please check your rights and try again. Your user may need to be added to the RDP group first";
WmiQueryTool = null;
ScavengeStatus(pHost, false);
break;
default:
error = pHost + " " + WmiQueryTool.WmiResults.WmiError.Message.ToString() + "\r\n\r\nSomething went horribly wrong. There's an error code here. Report it to the developer, along with what you were doing so he can replicate the issue";
break;
}
if (mResultsForm == null)
{
mResultsForm = new Form();
mResultsForm.FormClosed += mResultsForm_FormClosed;
resultsTextBox = new TextBox();
mResultsForm.Width = 615;
mResultsForm.Height = 433;
mResultsForm.Controls.Add(resultsTextBox);
mResultsForm.Text = "Error Window";
mResultsForm.MaximumSize = new Size(615, 433);
mResultsForm.MinimumSize = new Size(615, 433);
mResultsForm.SetDesktopLocation(0, 0);
resultsTextBox.Location = new Point(0, 0);
resultsTextBox.Size = new Size(600, 399);
resultsTextBox.Multiline = true;
resultsTextBox.ScrollBars = ScrollBars.Vertical;
resultsTextBox.Visible = true;
resultsTextBox.Enabled = true;
resultsTextBox.AppendText(error + "\r\n\r\n");
}
else
{
resultsTextBox.AppendText(error + "\r\n\r\n");
}
}
示例5: ShowMiniProfile
void ShowMiniProfile(object sender, JavascriptMethodEventArgs e)
{
try
{
SteamID profileId = new SteamID(Convert.ToUInt64(e.Arguments[0].ToString()));
var miniHtml = SteamTrade.SteamWeb.Fetch("http://steamcommunity.com/miniprofile/" + profileId.AccountID);
var file = File.ReadAllText(Application.StartupPath + "/Resources/MiniProfile.html");
file = file.Substring(0, file.IndexOf("<body>"));
file += "<body>" + miniHtml + "</body></html>";
File.WriteAllText(Application.StartupPath + "/Resources/MiniProfile.html", file);
MiniProfile.Close();
MiniProfile = new Form();
MiniProfile.Width = 300;
MiniProfile.Height = 144;
MiniProfile.ShowInTaskbar = false;
MiniProfile.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
MiniProfile.ControlBox = false;
var webControlMini = new Awesomium.Windows.Forms.WebControl();
webControlMini.DocumentReady += (sen, ev) => webControlMini_DocumentReady(sen, ev, MiniProfile);
webControlMini.Enabled = false;
webControlMini.Dock = DockStyle.Fill;
webControlMini.Source = (Application.StartupPath + "/Resources/MiniProfile.html").ToUri();
MiniProfile.Controls.Add(webControlMini);
MiniProfile.StartPosition = FormStartPosition.Manual;
MiniProfile.SetDesktopLocation(Cursor.Position.X, Cursor.Position.Y + 10);
MiniProfile.TopMost = true;
MiniProfile.Show();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
示例6: TestPublicMethods
//.........这里部分代码省略.........
c = new Form ();
c.Refresh ();
Assert.IsFalse (c.IsHandleCreated, "A22");
c.ResetBackColor ();
Assert.IsFalse (c.IsHandleCreated, "A23");
c.ResetBindings ();
Assert.IsFalse (c.IsHandleCreated, "A24");
c.ResetCursor ();
Assert.IsFalse (c.IsHandleCreated, "A25");
c.ResetFont ();
Assert.IsFalse (c.IsHandleCreated, "A26");
c.ResetForeColor ();
Assert.IsFalse (c.IsHandleCreated, "A27");
c.ResetImeMode ();
Assert.IsFalse (c.IsHandleCreated, "A28");
c.ResetRightToLeft ();
Assert.IsFalse (c.IsHandleCreated, "A29");
c.ResetText ();
Assert.IsFalse (c.IsHandleCreated, "A30");
c.SuspendLayout ();
Assert.IsFalse (c.IsHandleCreated, "A31");
c.ResumeLayout ();
Assert.IsFalse (c.IsHandleCreated, "A32");
c.Scale (new SizeF (1.5f, 1.5f));
Assert.IsFalse (c.IsHandleCreated, "A33");
c.Select ();
Assert.IsTrue (c.IsHandleCreated, "A34");
c.Dispose ();
c = new Form ();
c.SelectNextControl (new Control (), true, true, true, true);
Assert.IsFalse (c.IsHandleCreated, "A35");
c.SetBounds (0, 0, 100, 100);
Assert.IsFalse (c.IsHandleCreated, "A36");
c.Update ();
Assert.IsFalse (c.IsHandleCreated, "A37");
// Form
c.Activate ();
Assert.IsFalse (c.IsHandleCreated, "F1");
c.AddOwnedForm (new Form ());
Assert.IsFalse (c.IsHandleCreated, "F2");
c.Close ();
Assert.IsFalse (c.IsHandleCreated, "F3");
c.Hide ();
Assert.IsFalse (c.IsHandleCreated, "F4");
c.LayoutMdi (MdiLayout.Cascade);
Assert.IsFalse (c.IsHandleCreated, "F5");
#if !MONO
c.PerformAutoScale ();
Assert.IsFalse (c.IsHandleCreated, "F6");
#endif
c.PerformLayout ();
Assert.IsFalse (c.IsHandleCreated, "F7");
c.AddOwnedForm (new Form ());
c.RemoveOwnedForm (c.OwnedForms [c.OwnedForms.Length - 1]);
Assert.IsFalse (c.IsHandleCreated, "F8");
c.ScrollControlIntoView (null);
Assert.IsFalse (c.IsHandleCreated, "F9");
c.SetAutoScrollMargin (7, 13);
Assert.IsFalse (c.IsHandleCreated, "F10");
c.SetDesktopBounds (-1, -1, 144, 169);
Assert.IsFalse (c.IsHandleCreated, "F11");
c.SetDesktopLocation (7, 13);
Assert.IsFalse (c.IsHandleCreated, "F12");
c = new Form ();
c.Show (null);
Assert.IsTrue (c.IsHandleCreated, "F13");
c.Close ();
c = new Form ();
//c.ShowDialog ()
c.ToString ();
Assert.IsFalse (c.IsHandleCreated, "F14");
c.Validate ();
Assert.IsFalse (c.IsHandleCreated, "F15");
#if !MONO
c.ValidateChildren ();
Assert.IsFalse (c.IsHandleCreated, "F16");
#endif
c.Close ();
}
示例7: SetDesktopLocationTest
public void SetDesktopLocationTest ()
{
Form myform = new Form ();
myform.ShowInTaskbar = false;
myform.Visible = true;
myform.Text = "NewForm";
myform.Name = "FormTest";
myform.SetDesktopLocation (10, 10);
Assert.AreEqual (10, myform.DesktopLocation.X, "#46");
myform.Dispose ();
}
示例8: PositionBottomRightDesktop
public static void PositionBottomRightDesktop(Form Target)
{
Rectangle desktopDimenions = Screen.PrimaryScreen.WorkingArea;
Point topLeft = new Point(desktopDimenions.Width - Target.Width - 5, desktopDimenions.Height - Target.Height - 5);
Target.SetDesktopLocation(topLeft.X, topLeft.Y);
}
示例9: SetFormToRightEdge
public static void SetFormToRightEdge(Form fm)
{
Rectangle monitor = GetCurrentMonitor(fm);
fm.SetDesktopLocation(monitor.Right - fm.Width, 0);
fm.Size = new Size(fm.Size.Width, monitor.Bottom - fm.Location.Y);
LeftSide = false;
}