[assembly: CommandClass(typeof(test.Class1))]namespace test{ public class Class1 { [CommandMethod("TT", CommandFlags.Session | CommandFlags.UsePickSet)] public static void TT() { HookLib.ShowForm("Form1"); } }}//str为窗体名,除了命名空间字符串外,所有的字符串。//如果窗体的全路径为:test1.test2.test3.test4.Form1,则str为:test2.test3.test4.Form1public static void ShowForm(string str){ if (Frm == null || Frm.IsDisposed) { Assembly assembly = Assembly.GetExecutingAssembly(); Frm = assembly.CreateInstance($"{MethodBase.GetCurrentMethod().DeclaringType.Namespace}.{str}") as Form; size = new Size(400, 400); ZwSoft.ZwCAD.ApplicationServices.Application.ShowModelessDialog(Frm); CmdRegisterHook(); } else Frm.Show();}