空白のキャプションを使用して、 MenuItem を初期化します。
Public Sub New()
[C#]
public MenuItem();
[C++]
public: MenuItem();
[JScript]
public function MenuItem();
解説
このコンストラクタを使用して空白の MenuItem を作成した後で、 MenuItem クラスのプロパティやメソッドを使用して、作成した MenuItem の外観や動作を指定できます。
使用例
[Visual Basic, C#, C++] このバージョンのコンストラクタを使用して MenuItem を作成する例を次に示します。
Public Sub CreateMyMenu()
' Create an empty menu item object.
Dim menuItem1 As New MenuItem()
' Intialize the menu item using the parameterless version of the constructor.
' Set the caption of the menu item.
menuItem1.Text = "&File"
End Sub
[C#]
public void CreateMyMenu()
{
// Create an empty menu item object.
MenuItem menuItem1 = new MenuItem();
// Intialize the menu item using the parameterless version of the constructor.
// Set the caption of the menu item.
menuItem1.Text = "&File";
}
[C++]
public:
void CreateMyMenu()
{
// Create an empty menu item object.
MenuItem* menuItem1 = new MenuItem();
// Intialize the menu item using the parameterless version of the constructor.
// Set the caption of the menu item.
menuItem1->Text = S"&File";
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
MenuItem クラス | MenuItem メンバ | System.Windows.Forms 名前空間 | MenuItem コンストラクタのオーバーロードの一覧