private void toolStripButton1_Click(object sender, EventArgs e) { if (ftb == null || ftb.IsDisposed) //if (ftb == null)//关掉工具栏后无法重开 { ftb = new frmToolBox(); ftb.TopLevel = false; //不加就变成顶级,无法添加 ftb.Parent = this; ftb.Show(); } //与菜单项事件完全一样的代码 }
private void 工具栏ToolStripMenuItem_Click(object sender, EventArgs e) { if (ftb == null || ftb.IsDisposed) //关掉工具栏后可以重开 //if (ftb == null)//关掉工具栏后无法重开 { ftb = new frmToolBox(); ftb.TopLevel = false; //不加就变成顶级,无法添加 ftb.Parent = this; ftb.Show(); } }