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

SetDesktopLocation() public method

public SetDesktopLocation ( int x, int y ) : void
x int
y int
return void
		public void SetDesktopLocation(int x, int y) {
			DesktopLocation = new Point(x, y);
		}

Usage Example

Example #1
0
        void RegisterQuickieText()
        {
            DockPanel.Click += (s, a) =>
            {
                var tb = new System.Windows.Forms.TextBox();
                var f  = new System.Windows.Forms.Form();

                tb.KeyDown += (kps, kpa) =>
                {
                    if (kpa.KeyCode == Keys.Escape)
                    {
                        f.Close();
                    }
                    if (kpa.KeyCode == Keys.Enter)
                    {
                        var command = tb.Text.ToLowerInvariant();
                        // Do some more intelligent stuff
                        // than this:

                        if (command.StartsWith("remove"))
                        {
                            var id = command.Split(' ')[1];
                            Hierarchy.Remove(long.Parse(id));
                        }

                        if (command == "com")
                        {
                            this.Commands.Add("Hey " + this.Commands.Count(), (n, x) => { MessageBox.Show(n.NodeDataAdapter.GetDisplayName()); }, "Nice one buddy");
                        }
                        if (command == "comr")
                        {
                            var first = this.Commands.First();
                            //  if (first != null) Hierarchy.Commands.RemoveItem(first);
                        }
                        f.Close();
                    }
                };


                tb.Width          = 300;
                tb.Font           = Consolas975;
                f.WindowState     = FormWindowState.Normal;
                f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                f.Controls.Add(tb);
                f.Show();
                f.SetDesktopLocation(Cursor.Position.X, Cursor.Position.Y);
                f.ClientSize = tb.Size;
            };
        }
All Usage Examples Of System.Windows.Forms.Form::SetDesktopLocation
Form