成员吧 关注:179贴子:142
  • 0回复贴,共1

声明私有的Form成员变量,初始化值为null运行窗体后值还为空

只看楼主收藏回复

private Form GetForm = null;
private void openChildFrom(Form childForm)
{
if (GetForm != null) //这里运行后应为不为空的
{
GetForm.Close();
GetForm = childForm;
childForm.TopLevel = false;
childForm.FormBorderStyle = FormBorderStyle.None;
childForm.Dock = DockStyle.Fill;
panelFill.Controls.Add(childForm);
panelFill.Tag = childForm;
childForm.BringToFront();
childForm.Show();
}
}


IP属地:天津1楼2022-10-04 00:35回复