public static void SetCategoryHidden(Document doc, BuiltInCategory builtInCategory, bool n) { try { Categories cates = doc.Settings.Categories; Category cate = cates.get_Item(builtInCategory); doc.ActiveView.SetCategoryHidden(cate.Id, n); } catch (Exception) { TaskDialog.Show("Error", "设置类别可见性失败"); } }