private void tSB_设备管理_Click(object sender, EventArgs e) { F_DeviceManage f_DeviceManage = F_DeviceManage.GetInstance(); f_DeviceManage.Show(dockPanel1); f_DeviceManage.DockTo(dockPanel1, DockStyle.Left);//左边停靠 }
/// <summary> /// 获取设备管理的实例 /// </summary> /// <returns></returns> public static F_DeviceManage GetInstance() { if (Instance == null) { Instance = new F_DeviceManage(); } return(Instance); }
private void tSBtn_设备管理_Click(object sender, EventArgs e) { //若设备管理窗口没有实例化或已经被释放(关闭了) if (f_DeviceManage == null || f_DeviceManage.IsDisposed == true) { f_DeviceManage = F_DeviceManage.GetInstance(); f_DeviceManage.Show(dockPanel1); f_DeviceManage.DockTo(dockPanel1, DockStyle.Left);//左边停靠 } }
private void F_DeviceManage_FormClosing(object sender, FormClosingEventArgs e) { Instance = null; // 否则下次打开时报错,提示“无法访问已释放对象” }
private void F_Main_Load(object sender, EventArgs e) { f_DeviceManage = F_DeviceManage.GetInstance(); f_DeviceManage.Show(dockPanel1); f_DeviceManage.DockTo(dockPanel1, DockStyle.Left);//左边停靠 }