物料主界面使用DEV 的Rinnbon control
使用MDI,main_form为父窗口
//
// Main_Form
//
this.IsMdiContainer = true;
this.Name = "Main_Form";
this.ShowIcon = false;
this.Text = "SY_BOM/采购与仓储";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.Main_Form_Load);
this.ResumeLayout(false);
设定只能打开一个子窗口,
在打开子窗口时判断有否有活动子窗口并试图关闭,
private void buyList_barButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
//关闭所有子窗口
foreach (Form child_form in this .MdiChildren )
{
child_form.Close();
}
//没有子窗口后,建新窗口
//同时只能有一个子窗口
if (this.ActiveMdiChild ==null )
{
BuyList_Form My_BuyList_Form = new BuyList_Form();
My_BuyList_Form.MdiParent = this;
My_BuyList_Form.Show();
}
}