//还是先上万一老师的原代码
//隐藏与显示菜单
Self.Menu := nil; {隐藏菜单}
Self.Menu := MainMenu1; {显示菜单}
//初一看到代码,我有点抓不到感觉的意思...
//我觉得我得自己写一个,万老师这个自当是绝佳的参考资料...
unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Self.Menu := nil; {隐藏菜单}
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Self.Menu := MainMenu1; {显示菜单}
end;
end.
//写到这的时候,我明白了...
//万老师是把精要的两句提出来了...
//我的小DEMO:http://files.cnblogs.com/files/FanYs/TMainMenu.rar