You are on page 1of 12

Menu

Pemrograman Visual (TH22012 )


by Kartika Firdausy
pvisual@ee.uad.ac.id
blog.uad.ac.id/kartikaf
kartikaf.wordpress.com

Overview
A menu of a computer program is a list of
actions that can be performed on that
application.
To be aware of these actions, the list must be
presented to the user upon request.
A menu is considered a main menu, when it
carries most of the actions the user can perform
on a particular application.
Such a menu is positioned on the top section of
the form in which it is used.
2

Overview
A main menu is divided in categories of items
and each category is represented by a word.
On the Visual Studio's IDE, the categories of
menus are File, Edit, Project, Window, etc.
To use a menu, the user first clicks one of the
words that displays on top. Upon clicking, the
menu expands and displays a list of items that
belong to that category.
3

Overview
There is no strict rule on how a menu is
organized.
There are only suggestions.
For example:
actions that are related to file processing, such as
creating a new file, opening an existing file, saving a
file, printing the open file, or closing the file usually
stay under a category called File.
In the same way, actions related to viewing
documents can be listed under a View menu.
4

Main Menu Creation


The main menu is
implemented through the
MainMenu class.
To create a main menu,
on the Toolbox, you can
click the MenuStrip
button and click the form
that will use the menu.

Main Menu Creation


After clicking the form, an empty menu is initiated,
waiting for you to add the necessary menu item.
To create a menu category that starts a list of items that
belong to the menu object, click the Type Here line and
type the desired item then press Enter.

Shortcut Key
Menu pada program aplikasi, umumnya
dapat juga diakses melalui keyboard
menggunakan shortcut key.
Misal pada MS Powerpoint menu File
dapat diakses dengan cara menekan
tombol Alt dan F.
A shortcut is a key or a combination of
keys that the user can press to perform
an action that would also be performed
using a menu item.

When creating a menu, to specify a


shortcut, use the Shortcut field in the
Properties window.
9

Contoh

10

Menu Style
Properties -> Events -> Click
sub menu Bold
private: System::Void boldToolStripMenuItem_Click(System::Object^ sender,
System::EventArgs^ e)
{
labelUAD->Font = gcnew System::Drawing::Font(labelUAD->Font,
FontStyle::Bold);
}

sub menu Italic


private: System::Void italicToolStripMenuItem_Click(System::Object^ sender,
System::EventArgs^ e)
{
labelUAD->Font = gcnew System::Drawing::Font(labelUAD->Font,
FontStyle::Italic);
}

sub menu Bold Italic


private: System::Void boldItalicToolStripMenuItem_Click(System::Object^ sender,
System::EventArgs^ e)
{
labelUAD->Font = gcnew System::Drawing::Font(labelUAD->Font,
FontStyle::Bold+FontStyle::Italic);
11
}

Menu Warna
Properties -> Events -> Click
sub menu Hitam
private: System::Void hitamToolStripMenuItem_Click(System::Object^ sender,
System::EventArgs^ e)
{
labelUAD->ForeColor = System::Drawing::Color::Black;
}

sub menu Kuning


private: System::Void kuningToolStripMenuItem_Click(System::Object^ sender,
System::EventArgs^ e)
{
labelUAD->ForeColor = System::Drawing::Color::Yellow;
}

12

You might also like