/// <summary> /// 点击NavBarItem显示窗体 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowForm(object sender, NavBarLinkEventArgs e) { NavBarItem item = sender as NavBarItem; NavBarItemTag t = (NavBarItemTag)item.Tag; if (String.IsNullOrEmpty(t.AssemblyDll) || String.IsNullOrEmpty(t.AssemblyName)) { return; } if (!FindForm(t.Memo)) { try { string assemblyName = t.AssemblyName; //"OrderList.FormOrderList"; Assembly assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + t.AssemblyDll); //需要使用绝对目录 Type type = assembly.GetType(assemblyName); object obj = Activator.CreateInstance(type); FObject f = (FObject)obj; f.Text = t.ItemText; f.EventSendMessageToFormMain += new EventHandler(f_EventSendMessageToFormMain); f.Memo = t.Memo; f.Tag = t.Memo;//Tag; f.MdiParent = this; f.ShowMessage(); f.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }