Delphi menu component TMainMenu use method detailed
This article shares the use of the menu component TMainMenud for your reference, the specific content is as follows
The menu component TMainMenu
To add a menu item, double-click TmenuMain and click Caption
Add a divider in the menu simply add "-" to add a divider
Cascade menu design
Click the right mouse button and select Create Submenu menu item from the pop-up menu
Single function design
To design the menu item, select the RadioItem property to True and the Checked property to True
Design of the check function
In the Design menu item, select the RadioItem property to False and the Checked property to True
Dynamic creation menu
Source code is as follows
procedure TForm1.Button1Click(Sender: TObject); var MainMenu: TMainMenu; MenuItem: TMenuItem; begin // Create a main menu. MainMenu:=TMainMenu.Create(self); Self.Menu:=MainMenu; // File menu creation MenuItem:= TMenuItem.Create(MainMenu); Caption:=' file '; MainMenu.Items.Add(MenuItem); // Create a new submenu.Create MenuItem:=TMenuItem. create (MainMenu); Caption:=' New '; MainMenu.Items[0].Add(MenuItem); // Submenu creation MenuItem:= TMenuItem.Create(MainMenu); Caption:=' Open '; MainMenu.Items[0].Items[0].Add(MenuItem); MenuItem:= TMenuItem.Create(MainMenu); Caption:=' Save '; MainMenu.Items[0].Items[0].Add(MenuItem); end; end.
Add ICONS to the main menu
To add an icon to the menu, first specify the icon for the menu using the TImagaList component, set the Images property in the menu to ImageList1, and then select the icon index to add. As shown in the picture:
The above is the whole content of this article, I hope to help you learn, but also hope that you support the script home.
Related article
-
Delphi uses TActionList to implement the method of downloading files
This article mainly introduces Delphi with TActionList download file method, need friends can refer to the next2014-07-07 -
Delphi to the time operation method summary
This article mainly introduces Delphi to the time operation method summary, you can have a more in-depth understanding of Delphi time operation, need friends can refer to2014-07-07 -
Delphi set conditional breakpoint method explanation
This article mainly introduces Delphi to set conditional breakpoint method, there is a need for friends can refer to2014-01-01 -
Delphi OpenGL2d drawing initialization process detailed
This article mainly introduces Delphi OpenGL2d drawing initialization process detailed, for the overall understanding of OpenGL is very helpful, the need of friends can refer to the next2014-07-07 -
Delphi creates its own cursor instance on the form
This article mainly introduces Delphi on the form to create their own cursor instance of the relevant information, I hope that through this article can help you, the need of friends can refer to2017-09-09 -
Delphi picture scroll switch complete instance code
This article mainly introduces Delphi image rolling switch complete instance code, through this example, readers can further grasp Delphi controls and graphics processing skills, need friends can refer to2014-07-07 -
Delphi implementation to get a handle and send a message method
This article mainly introduces Delphi implementation to obtain the handle and send a message method, the need for friends can refer to the next2014-07-07 -
Delphi books 15 web disk download address sorting
Delphi garden organized Delphi books 15 commonly used reference books, need friends can download.2011-12-12 -
Delphi implementation Trojan file transfer code instance
This article mainly introduces the Delphi Trojan file transfer method, for understanding the operating principle of the Trojan has a certain help, the need of friends can refer to2014-07-07
Latest comments