private void btnLogin_Click(object sender, EventArgs e) { ToolStripItem btnLogin = this.questMenu.Items.Find("btnLogin", true)[0]; btnLogin.Enabled = false; btnLogin.MouseEnter -= btn_MouseEnter; btnLogin.MouseLeave -= btn_MouseLeave; this.Cursor = Cursors.Default; this.panel1.Controls.Remove(this._panel); LoginPanel loginPanel = new LoginPanel(this.Height, this.Width); loginPanel.btnCancel.Click += btnClose_Clicked; loginPanel.btnOk.Click += btnOk_Clicked; loginPanel.TopLevel = false; loginPanel.StartPosition = FormStartPosition.Manual; loginPanel.Location = new Point(this.Location.X + (this.Width - loginPanel.Width) / 2, this.Location.Y + (this.Height - loginPanel.Height) / 2); this.panel1.Controls.Clear(); this.panel1.Controls.Add(loginPanel); loginPanel.Show(); }