Menu.MenuItemCollection.Find(String, Boolean) 方法

定义

查找具有指定键的项,还可以选择搜索子菜单项。

public:
 cli::array <System::Windows::Forms::MenuItem ^> ^ Find(System::String ^ key, bool searchAllChildren);
public System.Windows.Forms.MenuItem[] Find (string key, bool searchAllChildren);
member this.Find : string * bool -> System.Windows.Forms.MenuItem[]
Public Function Find (key As String, searchAllChildren As Boolean) As MenuItem()

参数

key
String

要搜索的菜单项名称。

searchAllChildren
Boolean

若要搜索子菜单项,则为 true,否则为 false

返回

一个 MenuItem 对象数组,它的 Name 属性与指定 key 相匹配。

例外

keynull 或空字符串。

注解

键比较不区分大小写。 key如果 参数为 null 或为空字符串,或者没有匹配项,Find则 返回空数组。

属性Name对应于 中 Menu.MenuItemCollectionMenuItem键。

适用于