void TextBox_MouseClick(object sender, MouseEventArgs e) { if (this.TextBox.Text == "常用模板") { this.TextBox.SelectionStart = 0; if (form == null || !form.Created) { form = new OrdChildfrm(); form.btnClick += new MouseEventHandler(btnOk_MouseClick); form.btnOk.Text = "Dsadsd"; Point p = this.ParentForm.PointToScreen(this.TextBox.Location); this.ParentForm.Invalidate(); form.Location = new Point(p.X, p.Y + this.Size.Height - (this.TextBox.Location.Y - this.Location.Y)); this.form.Size = new Size(this.ParentForm.Parent.Size.Width - this.TextBox.Location.X, this.ParentForm.Parent.Size.Height - (this.Size.Height + this.Location.Y)); form.Show(); this.TextBox.Focus(); } else { Secondflag = false; form.Show(); Secondflag = true; this.TextBox.Focus(); } } }
void SearchControlView_MouseClick(object sender, MouseEventArgs e) { if (form == null || !form.Created) { form = new OrdChildfrm(); form.Text = "常用模板"; form.btnClick += new MouseEventHandler(btnOk_MouseClick); form.StartPosition = FormStartPosition.CenterScreen; this.form.Size = new Size(this.ParentForm.Parent.Size.Width - this.Location.X + 20, this.ParentForm.Parent.Size.Height - (this.Size.Height + this.Location.Y)); form.ShowDialog(this.ParentForm); } else { form.ShowDialog(this.ParentForm); } }