Home

SpeakComputers.com | Text-to-Speech Software

Natural sounding TTS voice support | Cepstral TTS voices | Text to MP3 | Natural Readers

Text to Speech Software Text to Speech Voices SpeakComputer Text to Speech Software

C++ MenuStrip Control.

The C++ Windows MenuStrip control provides an application menu system. The menustrip works with both Single document interfaces SDI and Multiple document interfaces MDI. With MDI applications the MenuStrip can be configured to merge with the main form for better navigation.

Namespace: System::Windows::Forms
System.Windows.Forms (in system.windows.forms.dll)

Creating an new C++ Windows forms MenuStrip.
MenuStrip^ menustrip = gcnew MenuStrip;

Assigning a new location for the C++ Windows Forms MenuStrip.
menustrip->Location = Point(0,0);

Assigning a size value to the C++ MenuStrip.
menustrip->Size = System::Drawing::Size(this->Width, 24);

Now we need to add menuitems to the menustrip control. The items I am speaking about are the dropdown menus, File, Edit, Windows etc, and the clickable button items within the menus, Open, Save, SaveAS etc.

Adding the first menu item - MenuStripItem.
ToolStripMenuItem^ menuitem1 = gcnew ToolStripMenuItem;

Assigning a text value to the MenuStripItem
menuitem1->Text = "File";

Adding an image to the MenuStripItem.
menuitem1->Image = Image::FromFile("E:\\file.png");

Now we add the first MenuStripItem to the MenuStrip itself.
menustrip->Items->Add(menuitem1);

Next we are going to add a second MenuStripItem but we are going to add it to the first MenuStripItem as a dropdown item.
ToolStripMenuItem^ menuitem2 = gcnew ToolStripMenuItem;
menuitem2->Text = "Exit";

Adding menuitem2 as a DropDown Menu item.
menuitem1->DropDownItems->Add(menuitem2);

Adding a C++ MenuStrip control to the form.
this->Controls->Add(menustrip);

Assign the MainMenuStrip to the form.
this->MainMenuStrip = menustrip;

Creating a Click Event for the C++ MenuStripItem control.
menuitem2->Click += gcnew System::EventHandler(this, &Form1::menuitem2_Click);

Responding to the C++ MenuStripItem Click event.
private: Void menuitem2_Click( Object^ sender, System::EventArgs^ e )
{
MessageBox::Show("Menuitem Clicked");
}

C++ MenuStrip control Tutorial.
Top of page
Text to Speech Speech synthesis Software TTS Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
About Privacy Policy TTS Resouces
Free Text to Speech software
Free Text to Speech Software