private void btn_operation_Click(object sender, EventArgs e) { try { if (Status != 0) { MessageBox.Show("作业中不可切换界面"); return; } this.panel_mainArea.Controls.Remove(UserControl); if (OperationForm == null) { OperationForm = new OperationForm(); } if (UserControl != null && UserControl.Name != "OperationForm") { UserControl.Dispose(); } UserControl = OperationForm; this.panel_mainArea.Controls.Add(UserControl); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public MainForm() { InitializeComponent(); //启动自动加载操作界面 OperationForm = new OperationForm(); UserControl = OperationForm; this.panel_mainArea.Controls.Add(UserControl); Status = 0; }