主题:时时添加POPUPMENU的子菜单!真正的高手请进。
jche131
[专家分:0] 发布于 2006-08-17 11:52:00
如题!
如何时时添加POPUPMENU的子菜单!
回复列表 (共1个回复)
沙发
dodolon [专家分:400] 发布于 2006-08-19 20:48:00
应该是“实时添加POPUPMENU的子菜单”吧?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
PopupMenu1: TPopupMenu;
procedure FormCreate(Sender: TObject);
private
procedure MenuItemClick(Sender: TObject);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.MenuItemClick(Sender: TObject);
begin
Application.MessageBox('你点击了弹出菜单项。','实时添加POPUPMENU的子菜单');
end;
procedure TForm1.FormCreate(Sender: TObject);
var
MenuItem: TMenuItem;
begin
MenuItem:=TMenuItem.Create(Self);
MenuItem.Caption:='Action1';
MenuItem.OnClick:=MenuItemClick;
PopupMenu1.Items.Add(MenuItem);
end;
end.
我来回复