F
fongling5355
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
NewItem:TMenuItem;
begin
NewItem:=TMenuItem.Create(MainMenu1);
NewItem.Caption:='test';
NewItem.OnClick:=MyNewItemClick;
MainMenu1.Items[0].Insert(MainMenu1.Items[0].Count,
NewItem);
end;
procedure TForm1.MyNewItemClick(sender: TObject);
begin
Memo1.Lines.LoadFromFile(
(Sender as TMenuItem).Caption);
end;
我使用自动生成菜单项, 为什么会出现: Menu index out range.
var
NewItem:TMenuItem;
begin
NewItem:=TMenuItem.Create(MainMenu1);
NewItem.Caption:='test';
NewItem.OnClick:=MyNewItemClick;
MainMenu1.Items[0].Insert(MainMenu1.Items[0].Count,
NewItem);
end;
procedure TForm1.MyNewItemClick(sender: TObject);
begin
Memo1.Lines.LoadFromFile(
(Sender as TMenuItem).Caption);
end;
我使用自动生成菜单项, 为什么会出现: Menu index out range.