Menu.MenuItems プロパティとは? わかりやすく解説

Menu.MenuItems プロパティ

メニュー関連付けられている MenuItem オブジェクトコレクションを示す値を取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public ReadOnly Property
 MenuItems As MenuItemCollection
Dim instance As Menu
Dim value As MenuItemCollection

value = instance.MenuItems
public MenuItemCollection MenuItems { get;
 }
public:
property MenuItemCollection^ MenuItems {
    MenuItemCollection^ get ();
}
/** @property */
public MenuItemCollection get_MenuItems ()
public function get MenuItems
 () : MenuItemCollection

プロパティ
メニュー格納されMenuItem オブジェクトリストを表す System.Windows.Forms.Menu.MenuItemCollection。

解説解説
使用例使用例

派生クラス MainMenuインスタンス作成しMenuItem オブジェクトコレクションMenuItem オブジェクト追加するコード例次に示します。この例で定義されるメソッドは、フォームクラス内に記述し、そのフォーム クラスメソッドから呼び出す必要があります

Private Sub InitializeMyMainMenu()
    ' Create the MainMenu and the MenuItem to add.
    Dim mainMenu1 As New
 MainMenu()
    Dim menuItem1 As New
 MenuItem("&File")
       
    ' Use the MenuItems property to call the Add method
    ' to add the MenuItem to the MainMenu menu item collection. 
    mainMenu1.MenuItems.Add(menuItem1)
       
    ' Assign mainMenu1 to the form.
    Me.Menu = mainMenu1
End Sub

private void InitializeMyMainMenu()
{
   // Create the MainMenu and the MenuItem to add.
   MainMenu mainMenu1 = new MainMenu();
   MenuItem menuItem1 = new MenuItem("&File");
   
   /* Use the MenuItems property to call the Add method
      to add the MenuItem to the MainMenu menu item collection. */
   mainMenu1.MenuItems.Add (menuItem1);

   // Assign mainMenu1 to the form.
   this.Menu = mainMenu1;
}

private:
   void InitializeMyMainMenu()
   {
      // Create the MainMenu and the MenuItem to add.
      MainMenu^ mainMenu1 = gcnew MainMenu;
      MenuItem^ menuItem1 = gcnew MenuItem( "&File" );
      
      /* Use the MenuItems property to call the Add method
         to add the MenuItem to the MainMenu menu item collection. */
      mainMenu1->MenuItems->Add( menuItem1 );
      
      // Assign mainMenu1 to the form.
      this->Menu = mainMenu1;
   }
private void InitializeMyMainMenu()
{
    // Create the MainMenu and the MenuItem to add.
    MainMenu mainMenu1 = new MainMenu();
    MenuItem menuItem1 = new MenuItem("&File");

    /* Use the MenuItems property to call the Add method
       to add the MenuItem to the MainMenu menu item collection.
     */
    mainMenu1.get_MenuItems().Add(menuItem1);

    // Assign mainMenu1 to the form.
    this.set_Menu(mainMenu1);
} //InitializeMyMainMenu
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Menu クラス
Menu メンバ
System.Windows.Forms 名前空間
MainMenu クラス
ContextMenu クラス
MenuItem
System.Windows.Forms.Menu.MenuItemCollection


このページでは「.NET Framework クラス ライブラリ リファレンス」からMenu.MenuItems プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からMenu.MenuItems プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からMenu.MenuItems プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Menu.MenuItems プロパティ」の関連用語

Menu.MenuItems プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Menu.MenuItems プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS