Delphi's menu component (Tmainmenu)

Source: Internet
Author: User

Menu Component Tmainmenu

Create a menu double-click Tmenumain, and you can add a menu item by clicking Caption

 

Add a split line to the menu by simply adding "-" to add a split line

Cascading menu Design

Click the right mouse button pop-up menu to Choose Create Submenu menu item

Single-selection function design

To select the Radioitem property in the menu item that is designed to be true,checked property is True

The design of the check function

Select the Radioitem property in the Design menu item for the False,checked property to True

Creating menus dynamically

  

The source code is as follows

procedure Tform1.button1click (sender:tobject);varMainmenu:tmainmenu; Menuitem:tmenuitem;begin
Main Menu Create MainMenu:=tmainmenu.create (self); Self.menu:=MainMenu; File menu Create MenuItem:=tmenuitem.create (MainMenu); Menuitem.caption:='file'; MAINMENU.ITEMS.ADD (MenuItem); Create a new submenu MenuItem:=tmenuitem.create (MainMenu); Menuitem.caption:='New'; mainmenu.items[0]. ADD (MenuItem); submenu in submenu Create MenuItem:=tmenuitem.create (MainMenu); Menuitem.caption:='Open'; mainmenu.items[0]. items[0]. ADD (MenuItem); MenuItem:=tmenuitem.create (MainMenu); Menuitem.caption:='Save'; mainmenu.items[0]. items[0]. ADD (MenuItem); end;end.

Add an icon to the main menu

To add an icon to the menu, first use the Timagalist component to assign a good icon to the menu, set the Images property in the menu to ImageList1, and then select the icon index to add. :

Delphi's menu component (Tmainmenu)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.