MenuItem.IsParent プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



menuItem1 という名前の MenuItem に関連付けられているサブメニューがあるかどうかを判断するコード例を次に示します。サブメニューが存在する場合は、その Enabled プロパティを false に設定し、それらのサブメニューを無効にします。この例では、menuItem1 という名前の MenuItem が作成済みである必要があります。
Public Sub DisableMyChildMenus() ' Determine if menuItem2 is a parent menu. If menuItem2.IsParent = True Then ' Loop through all the submenus. Dim i As Integer For i = 0 To menuItem2.MenuItems.Count - 1 ' Disable all of the submenus of menuItem2. menuItem2.MenuItems(i).Enabled = False Next i End If End Sub
public void DisableMyChildMenus () { // Determine if menuItem2 is a parent menu. if(menuItem2.IsParent == true) { // Loop through all the submenus. for(int i = 0; i < menuItem2.MenuItems.Count; i++) { // Disable all of the submenus of menuItem2. menuItem2.MenuItems[i].Enabled = false; } } }
void DisableMyChildMenus() { // Determine if menuItem2 is a parent menu. if ( menuItem2->IsParent == true ) { // Loop through all the submenus. for ( int i = 0; i < menuItem2->MenuItems->Count; i++ ) { // Disable all of the submenus of menuItem2. menuItem2->MenuItems[ i ]->Enabled = false; } } }
public void DisableMyChildMenus() { // Determine if menuItem2 is a parent menu. if (menuItem2.get_IsParent() == true) { // Loop through all the submenus. for (int i = 0; i < menuItem2.get_MenuItems().get_Count(); i++) { // Disable all of the submenus of menuItem2. menuItem2.get_MenuItems().get_Item(i).set_Enabled(false); } } } //DisableMyChildMenus

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMenuItem.IsParent プロパティを検索する場合は、下記のリンクをクリックしてください。

- MenuItem.IsParent プロパティのページへのリンク