目前Form1
有textBox1
和Form1
具有StartPosition = CenterScreen
,该textBox1
有textBox1_MouseClick
单击文本框后,如何在文本框下方显示表单?
代码textBox1_MouseClick
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
Form2 frm2 = new Form2();
frm2.ShowDialog();
}
在Form2
也已经StartPosition = CenterScreen
当我点击textBox1
的Form2
将覆盖textBox1
。
我想要发生的是它不会覆盖textBox1
当Form2
将被显示时,它应该显示在textBox1
之下它就像一个工具提示。我怎样才能做到这一点?
更新的代码:
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
Form2 frm2 = new Form2();
frm2.StartPosition = FormStartPosition.Manual;
frm2.Location = new Point(this.Location.X + textBox1.Location.X, this.Location.Y + textBox1.Location.Y);
frm2.ShowDialog();
}
private void textBox2_MouseClick(object sender, MouseEventArgs e)
{
Form2 frm2 = new Form2();
frm2.StartPosition = FormStartPosition.Manual;
frm2.Location = new Point(this.Location.X + textBox2.Location.X, this.Location.Y + textBox2.Location.Y);
frm2.ShowDialog();
}
NO TEXTBOX点:
TextBox1的点:
TextBox2中CLICKED:
更新我的问题:) – 2013-03-03 07:05:17