本文整理汇总了C#中System.Windows.Forms.Form.SetDesktopBounds方法的典型用法代码示例。如果您正苦于以下问题:C# Form.SetDesktopBounds方法的具体用法?C# Form.SetDesktopBounds怎么用?C# Form.SetDesktopBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.SetDesktopBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreFormPlacement
public static void RestoreFormPlacement(RegistryKey key, Form form, string name)
{
Rectangle? rect = key.GetRectangleValue(name);
if (rect.HasValue)
{
Rectangle formBounds = rect.Value;
if (!form.IsMdiChild)
{
formBounds = EnsureFitsInDesktop(formBounds);
}
form.WindowState = FormWindowState.Normal;
form.SetDesktopBounds(formBounds.X, formBounds.Y, formBounds.Width, formBounds.Height);
}
FormWindowState? state = key.GetWindowStateValue(name);
if (state.HasValue)
{
form.WindowState = state.Value;
}
}
示例2: 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 ();
}
示例3: MakeVisible
//********************************************************************************
/// <summary>
///
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
/// <created>UPh,27.12.2007</created>
/// <changed>UPh,27.12.2007</changed>
//********************************************************************************
internal static void MakeVisible(Form form)
{
Rectangle rcBounds;
if (form.Parent != null)
{
rcBounds = form.Parent.ClientRectangle;
}
else
{
Screen screen = Screen.FromControl(form);
if (screen == null)
screen = Screen.PrimaryScreen;
if (screen == null)
return;
rcBounds = screen.Bounds;
}
Rectangle rcNewWnd = new Rectangle(form.Left, form.Top, form.Width, form.Height);
if (rcNewWnd.Right > rcBounds.Right)
rcNewWnd.Offset(rcBounds.Right - rcNewWnd.Right, 0);
if (rcNewWnd.Bottom > rcBounds.Bottom)
rcNewWnd.Offset(0, rcBounds.Bottom - rcNewWnd.Bottom);
if (rcNewWnd.Left < rcBounds.Left)
rcNewWnd.Offset(rcBounds.Left - rcNewWnd.Left, 0);
if (rcNewWnd.Top < rcBounds.Top)
rcNewWnd.Offset(0, rcBounds.Top - rcNewWnd.Top);
form.SetDesktopBounds(rcNewWnd.Left, rcNewWnd.Top, rcNewWnd.Width, rcNewWnd.Height);
}
示例4: Main
static void Main(string[] args)
{
game.Window.Title = "NinjaGame font tool: Please close this window to proceed";
game.Run();
s_form = new Form();
s_form.SetDesktopBounds(0,0,640,480);
s_form.Show();
s_form.Text = "NinjaGame XML font data Generator";
s_file_label = new Label();
s_file_label.SetBounds(20,20,100,20);
s_file_label.Text = "Font texture file:";
s_file_label.Parent = s_form;
s_file_text_box = new TextBox();
s_file_text_box.SetBounds(140,20,400,20);
s_file_text_box.Parent = s_form;
s_file_button = new Button();
s_file_button.SetBounds(540,20,40,20);
s_file_button.Text = "...";
s_file_button.Parent = s_form;
s_xna_file_label = new Label();
s_xna_file_label.SetBounds(20,40,100,20);
s_xna_file_label.Text = "XNA tex path:";
s_xna_file_label.Parent = s_form;
s_xna_file_text_box = new TextBox();
s_xna_file_text_box.SetBounds(140,40,400,20);
s_xna_file_text_box.Parent = s_form;
s_file_button.Click += new EventHandler(s_file_button_Click);
s_size_label = new Label();
s_size_label.SetBounds(20,60,100,20);
s_size_label.Text = "Font size:";
s_size_label.Parent = s_form;
s_size_text_box = new TextBox();
s_size_text_box.SetBounds(140,60,400,20);
s_size_text_box.Parent = s_form;
s_size_text_box.Text = "16";
s_r_label = new Label();
s_r_label.SetBounds(20,80,100,20);
s_r_label.Text = "Font color r:";
s_r_label.Parent = s_form;
s_r_text_box = new TextBox();
s_r_text_box.SetBounds(140,80,400,20);
s_r_text_box.Parent = s_form;
s_r_text_box.Text = "1";
s_g_label = new Label();
s_g_label.SetBounds(20,100,100,20);
s_g_label.Text = "Font color g:";
s_g_label.Parent = s_form;
s_g_text_box = new TextBox();
s_g_text_box.SetBounds(140,100,400,20);
s_g_text_box.Parent = s_form;
s_g_text_box.Text = "1";
s_b_label = new Label();
s_b_label.SetBounds(20,120,100,20);
s_b_label.Text = "Font color b:";
s_b_label.Parent = s_form;
s_b_text_box = new TextBox();
s_b_text_box.SetBounds(140,120,400,20);
s_b_text_box.Parent = s_form;
s_b_text_box.Text = "1";
s_a_label = new Label();
s_a_label.SetBounds(20,140,100,20);
s_a_label.Text = "Font color a:";
s_a_label.Parent = s_form;
s_a_text_box = new TextBox();
s_a_text_box.SetBounds(140,140,400,20);
s_a_text_box.Parent = s_form;
s_a_text_box.Text = "1";
s_char_spacing_label = new Label();
s_char_spacing_label.SetBounds(20,160,100,20);
s_char_spacing_label.Text = "Font char spacing:";
s_char_spacing_label.Parent = s_form;
s_char_spacing_text_box = new TextBox();
s_char_spacing_text_box.SetBounds(140,160,400,20);
s_char_spacing_text_box.Parent = s_form;
s_char_spacing_text_box.Text = "2";
s_line_spacing_label = new Label();
s_line_spacing_label.SetBounds(20,180,100,20);
s_line_spacing_label.Text = "Font line spacing:";
s_line_spacing_label.Parent = s_form;
//.........这里部分代码省略.........
示例5: SetDesktopBoundsTest
public void SetDesktopBoundsTest ()
{
Form myform = new Form ();
myform.ShowInTaskbar = false;
myform.Visible = true;
myform.Text = "NewForm";
myform.Name = "FormTest";
myform.SetDesktopBounds (10, 10, 200 , 200);
Assert.AreEqual (200, myform.DesktopBounds.Height, "#45");
myform.Dispose ();
}