void mnuFunction_Opening(object sender, CancelEventArgs e) { BaseTreeListTag treeListTag = _mainForm.treeList.FocusedNode.Tag as BaseTreeListTag; bool visible = (treeListTag.GetFunctionName().ToLower() == DefFun.DefIl.ToLower()); mniDescriptionAsComment.Visible = visible; //this menu item is only available for the function DefIL toolStripSeparator_DefIL.Visible = visible; }