[英]Cannot select text of TextBox control with mouse
I want to embed a Form
within another Form
. 我要嵌入
Form
另一个内Form
。 Here is what I have tried: 这是我尝试过的:
private void Form1_Load(object sender, EventArgs e)
{
Form2 form = new Form2();
form.TopLevel = false;
panel1.Controls.Add(form);
form.Dock = DockStyle.Fill;
form.Show();
}
Form1
is the parent form. Form1
是父窗体。 Form2
is the child form, which has a TextBox
control. Form2
是子窗体,它具有TextBox
控件。
The problem: After embedding the child form, the TextBox
in the child form cannot be selected with the mouse. 问题:嵌入子窗体后,无法用鼠标选择子窗体中的
TextBox
。
Can anyone help? 有人可以帮忙吗?
You need to setup the parent of the Form before calling .Show() 您需要在调用.Show()之前设置Form的父级。
form.Parent = this; form.Parent = this;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.