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.

返回

Name属性与指定的key对象匹配的对象数组MenuItem

例外

keynull 或空字符串。

注解

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

Name 属性对应于中某个 MenuItem 项的 Menu.MenuItemCollection键。

适用于