diff --git a/ContextMenuManager/Controls/EnhanceMenusList.cs b/ContextMenuManager/Controls/EnhanceMenusList.cs index 4737e9b..e57efc3 100644 --- a/ContextMenuManager/Controls/EnhanceMenusList.cs +++ b/ContextMenuManager/Controls/EnhanceMenusList.cs @@ -88,6 +88,7 @@ namespace ContextMenuManager.Controls if(shellXE != null) LoadShellItems(shellXE, groupItem); if(shellExXE != null) LoadShellExItems(shellExXE, groupItem); groupItem.IsFold = true; + groupItem.HideWhenNoSubItem(); } } catch { } diff --git a/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs b/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs index 317b3fb..c8ea150 100644 --- a/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs +++ b/ContextMenuManager/Controls/Interfaces/IFoldGroupItem.cs @@ -92,5 +92,15 @@ namespace ContextMenuManager.Controls.Interfaces MyToolTip.SetToolTip(BtnOpenPath, tip); this.SetNoClickEvent(); } + + public void HideWhenNoSubItem() + { + int count = 0; + foreach(var ctr in this.Parent.Controls) + { + if(ctr is IFoldSubItem item && item.FoldGroupItem == this) count++; + } + if(count == 0) this.Visible = false; + } } } \ No newline at end of file diff --git a/ContextMenuManager/Controls/ThirdRulesList.cs b/ContextMenuManager/Controls/ThirdRulesList.cs index d64bf99..15e01a6 100644 --- a/ContextMenuManager/Controls/ThirdRulesList.cs +++ b/ContextMenuManager/Controls/ThirdRulesList.cs @@ -65,6 +65,7 @@ namespace ContextMenuManager.Controls this.AddItem(new RegRuleItem(rules, itemInfo) { FoldGroupItem = groupItem, HasImage = false }); } groupItem.IsFold = true; + groupItem.HideWhenNoSubItem(); } } catch { }