protected override void OnShown(EventArgs e)
{
base.OnShown(e);
Location = new Point(TextInputWindow.MousePosition.X - Width / 2, TextInputWindow.MousePosition.Y - Height / 2);
this.EnsureOnScreen();
var screen = Screen.FromControl(this);
System.Drawing.Point newLocation = this.Location;
if (this.Bounds.Top < 0)
newLocation.Y = 0;
this.Location = newLocation;
textBox1.Focus();
}
}