⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainmenu.pas

📁 有不足之处请指出
💻 PAS
字号:
unit mainmenu;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ImgList, ComCtrls, ToolWin, ExtCtrls, StdCtrls, Buttons,
  DB, DBTables;

type
  Tmainmenuform = class(TForm)
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    N5: TMenuItem;
    N10: TMenuItem;
    N11: TMenuItem;
    N6: TMenuItem;
    N13: TMenuItem;
    N14: TMenuItem;
    N15: TMenuItem;
    N8: TMenuItem;
    N16: TMenuItem;
    CoolBar1: TCoolBar;
    ToolBar1: TToolBar;
    ImageList1: TImageList;
    StatusBar1: TStatusBar;
    Timer1: TTimer;
    N7: TMenuItem;
    N3: TMenuItem;
    N12: TMenuItem;
    N9: TMenuItem;
    N2: TMenuItem;
    N17: TMenuItem;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    ToolButton3: TToolButton;
    ToolButton4: TToolButton;
    ToolButton5: TToolButton;
    ToolButton6: TToolButton;
    ToolButton7: TToolButton;
    ToolButton8: TToolButton;
    ToolButton9: TToolButton;
    ToolButton10: TToolButton;
    ToolButton11: TToolButton;
    ToolButton12: TToolButton;
    ToolButton13: TToolButton;
    ToolButton14: TToolButton;
    ToolButton15: TToolButton;
    ToolButton16: TToolButton;
    ToolButton17: TToolButton;
    ToolButton18: TToolButton;
    ToolButton19: TToolButton;
    procedure N1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure N10Click(Sender: TObject);
    procedure N11Click(Sender: TObject);
    procedure N13Click(Sender: TObject);
    procedure N14Click(Sender: TObject);
    procedure N15Click(Sender: TObject);
    procedure N8Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure N16Click(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure ToolButton4Click(Sender: TObject);
    procedure ToolButton5Click(Sender: TObject);
    procedure ToolButton7Click(Sender: TObject);
    procedure ToolButton8Click(Sender: TObject);
    procedure ToolButton11Click(Sender: TObject);
    procedure ToolButton13Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure N7Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure N3Click(Sender: TObject);
    procedure ToolButton3Click(Sender: TObject);
    procedure ToolButton12Click(Sender: TObject);
    procedure ToolButton15Click(Sender: TObject);
    procedure ToolButton19Click(Sender: TObject);
    procedure ToolButton17Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
    procedure showstatushbar(Sender: TObject);
  end;

var
  mainmenuform: Tmainmenuform;
  quanxian:string;
  yonghuming:string;
  havelogon:boolean;

implementation

uses luru_unit, shanchubanji, shunxudayin, tongjidayin, tianjiabanji,
  xiugaibanji, AboutSoft, xitongweihu, chazhaoyuxiugai, xujiguanli, denglu;

{$R *.dfm}

procedure Tmainmenuform.showstatushbar(Sender: TObject);
begin
  if length(Application.Hint)>0 then
    begin
      StatusBar1.Panels.Items[0].Text :='状态:'+Application.Hint ;
    end
  else
    begin
      StatusBar1.Panels.Items[0].Text :='状态'+'';
    end;
end;
procedure Tmainmenuform.N1Click(Sender: TObject);
begin
    if quanxian='普通用户' then
      begin
        messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
        exit;
      end;
    luruform:=Tluruform.create(self);
end;

procedure Tmainmenuform.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
Action:=caFree;
end;

procedure Tmainmenuform.N10Click(Sender: TObject);
begin
shunxudayinForm:=TshunxudayinForm.create(self);
end;

procedure Tmainmenuform.N11Click(Sender: TObject);
begin
tongjidayinForm:=TtongjidayinForm.Create(self);
end;

procedure Tmainmenuform.N13Click(Sender: TObject);
begin
if quanxian='普通用户' then
      begin
        messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
        exit;
      end
else
tianjiabanjiForm:=TtianjiabanjiForm.Create(self);
end;

procedure Tmainmenuform.N14Click(Sender: TObject);
begin
  if not (quanxian='管理员') then
     begin
       messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
       exit;
     end
  else
shanchubanjiForm:=TshanchubanjiForm.Create(self);
end;

procedure Tmainmenuform.N15Click(Sender: TObject);
begin
if quanxian='普通用户' then
      begin
        messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
        exit;
      end
else
xiugaibanjiForm:=TxiugaibanjiForm.create(self);
end;

procedure Tmainmenuform.N8Click(Sender: TObject);
begin
Application.Terminate ;
end;

procedure Tmainmenuform.FormCreate(Sender: TObject);
var currentTime :Longint;
    i:integer;
begin
  havelogon:=True;
  currentTime:=GetTickCount div 1000;
  while ((GetTickCount div 1000)<(currentTime +3)) do;
  Application.OnHint :=showstatushbar;
  StatusBar1.Panels.Items[1].Text :='日期'+DATETOSTR(DATE);
 end;

procedure Tmainmenuform.N16Click(Sender: TObject);
begin
AboutForm:=TAboutForm.create(self);
end;

procedure Tmainmenuform.ToolButton1Click(Sender: TObject);
begin
    if quanxian='普通用户' then
      begin
        messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
        exit;
      end;
    luruform:=Tluruform.create(self);
end;

procedure Tmainmenuform.ToolButton4Click(Sender: TObject);
begin
shunxudayinForm:=TshunxudayinForm.create(self);
end;

procedure Tmainmenuform.ToolButton5Click(Sender: TObject);
begin
xuejiguanliForm:=TxuejiguanliForm.Create(self);

end;

procedure Tmainmenuform.ToolButton7Click(Sender: TObject);
begin
shunxudayinForm:=TshunxudayinForm.create(self);
end;

procedure Tmainmenuform.ToolButton8Click(Sender: TObject);
begin
tongjidayinForm:=TtongjidayinForm.Create(self);
end;

procedure Tmainmenuform.ToolButton11Click(Sender: TObject);
begin
if quanxian='普通用户' then
      begin
        messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
        exit;
      end
else
tianjiabanjiForm:=TtianjiabanjiForm.Create(self);

end;

procedure Tmainmenuform.ToolButton13Click(Sender: TObject);
begin
if quanxian='普通用户' then
      begin
        messagedlg('你不是高级用户或管理员,你无权执行本项操作!',mtWarning,[mbOk],0);
        exit;
      end
else
xiugaibanjiForm:=TxiugaibanjiForm.create(self);

end;

procedure Tmainmenuform.Timer1Timer(Sender: TObject);
begin
StatusBar1.Panels.Items[2].Text :='时间'+TIMETOSTR(TIME);
end;

procedure Tmainmenuform.N7Click(Sender: TObject);
begin
xitongweihuForm:=TxitongweihuForm.Create(self);
end;

procedure Tmainmenuform.N2Click(Sender: TObject);
begin
chazhaoyuxiugaiForm:=TchazhaoyuxiugaiForm.Create(self);
end;

procedure Tmainmenuform.FormShow(Sender: TObject);
begin
  dengluForm.ShowModal;
  havelogon:=denglu.havelogon ;
  if not havelogon then
     Application.Terminate ;
  yonghuming:=denglu.yonghu;
  quanxian:=denglu.quanxian ;
  chazhaoyuxiugai.qx:=quanxian;
  xujiguanli.qx:=quanxian;
  xitongweihu.dqyh:=yonghuming;
  xitongweihu.qx:=quanxian; 
  mainmenuForm.Caption :=mainmenuForm.Caption+'                   当前用户为:'+yonghuming+' ('+quanxian+')';


end;



procedure Tmainmenuform.ToolButton2Click(Sender: TObject);
begin
chazhaoyuxiugaiForm:=TchazhaoyuxiugaiForm.Create(self);
end;

procedure Tmainmenuform.N3Click(Sender: TObject);
begin
xuejiguanliForm:=TxuejiguanliForm.Create(self);
end;

procedure Tmainmenuform.ToolButton3Click(Sender: TObject);
begin
chazhaoyuxiugaiForm:=TchazhaoyuxiugaiForm.Create(self);
end;

procedure Tmainmenuform.ToolButton12Click(Sender: TObject);
begin
  if not (quanxian='管理员') then
     begin
       showmessage('当前用户类型为 "普通用户",你无权删除班级!'+#10+#13+'只有 "管理员" 才有删除班级的权限!');
       exit;
     end
  else
shanchubanjiForm:=TshanchubanjiForm.Create(self);

end;

procedure Tmainmenuform.ToolButton15Click(Sender: TObject);
begin
xitongweihuForm:=TxitongweihuForm.Create(self);
end;

procedure Tmainmenuform.ToolButton19Click(Sender: TObject);
begin
Application.Terminate ;
end;

procedure Tmainmenuform.ToolButton17Click(Sender: TObject);
begin
AboutForm:=TAboutForm.create(self);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -