System.Windows.Forms.Form.SetDesktopBounds C# (CSharp) Method

SetDesktopBounds() public method

public SetDesktopBounds ( int x, int y, int width, int height ) : void
x int
y int
width int
height int
return void
		public void SetDesktopBounds(int x, int y, int width, int height) {
			DesktopBounds = new Rectangle(x, y, width, height);
		}

Usage Example

        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;
              }
        }
All Usage Examples Of System.Windows.Forms.Form::SetDesktopBounds
Form