private void button1_Click(object sender, EventArgs e)
{
if (panel1.Controls.Count == 1)
(panel1.Controls[0] as Form).Close();
panel1.BringToFront();
Form frm = new Form();
frm.TopLevel = false;
//panel1.Controls.Add(frm);
frm.Parent = panel1;
frm.Dock = DockStyle.Fill;
frm.Show();
}
如果写成 frm.Show(this);则会出现下面的错误提示,去掉this就好了
Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling Show.
c++builder
FrmInfoBase = new TFrmInfoBase(Application, qry1);
Frm
Frm