平台:Delphi 2010
- 将TMainMenu拖放到Form1上。
- 将TPopupMenu拖放到Form1上。
- 添加MainMenu1和PopupMenu项。 (MainMenu --> 文件 --> Item1,PopupMenu --> 弹出项1)
- Item1.onRightClick显示PopupMenu。
- 按F9键。
- 在文件-->项目1上右键单击,选择弹出菜单中的项目1,然后进行其他操作。
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 222
ClientWidth = 447
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object MainMenu1: TMainMenu
Left = 136
Top = 64
object file1: TMenuItem
Caption = 'file'
object recentfile1: TMenuItem
Caption = 'item 1'
end
end
end
object PopupMenu1: TPopupMenu
Left = 24
Top = 136
object popupitem1: TMenuItem
Caption = 'popup item'
OnClick = popupitem1Click
end
end
end