private Find ( string key, bool searchAllChildren ) : System.Windows.Forms.ToolStripItem[] | ||
key | string | |
searchAllChildren | bool | |
return | System.Windows.Forms.ToolStripItem[] |
static ToolStripItem Find(ToolStripItemCollection items, String key, bool searchAllChildren) { var tis = items.Find(key, searchAllChildren); if (tis != null && tis.Length > 0) return tis[0]; foreach (ToolStripItem item in items) { if (item.Text.EqualIgnoreCase(key)) return item; } if (searchAllChildren) { foreach (ToolStripItem item in items) { var tdi = item as ToolStripDropDownItem; if (tdi != null) { var ti = Find(tdi.DropDownItems, key, searchAllChildren); if (ti != null) return ti; } } } return null; }