📄 main_form.pas
字号:
{***************************
** 主窗体 **
** Hblxp 2005-4-12 **
****************************}
unit Main_Form;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ComCtrls, jpeg, ExtCtrls, ToolWin, ImgList;
type
TMain = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
StatusBar1: TStatusBar;
Image1: TImage;
ImageList1: TImageList;
N12: TMenuItem;
N13: TMenuItem;
PopupMenu1: TPopupMenu;
N14: TMenuItem;
Timer1: TTimer;
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
procedure FormActivate(Sender: TObject);
procedure N13Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure ToolButton5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Main: TMain;
implementation
uses Login_Unit, About_Unit, Datamodule_Unit, User_Unit, Com_Info_Unit,
MacInfo_Unit, ShopInfo_Unit, BuyInfoUnit, BrowBuyInfo_Unit;
{$R *.dfm}
procedure TMain.FormActivate(Sender: TObject);
var
Path: string;
begin
Path := ExtractFilePath(Application.ExeName);
III := 0;
with Datamodule_Unit.DM do
begin
ADOConnection1.Connected := False;
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + Path + '\database.mdb;Persist Security Info=False';
ADOConnection1.Connected := True;
with Aq_user do
begin
Close;
SQL.Clear;
Sql.Add('select * from 用户信息表');
try
Open;
except
end;
if IsEmpty then
begin
Close;
SQL.Clear;
SQL.Add('Insert into 用户信息表 values (''System'',''系统管理员'','''')');
try
ExecSql;
except
end;
end;
end;
if not Assigned(Login_Form) then
begin
Login_Form := TLogin_Form.Create(Self);
end;
Login_Form.ShowModal;
Login_Form.Free;
end;
end;
procedure TMain.N13Click(Sender: TObject);
begin
if Application.MessageBox('你确定要退出本系统吗?', '提示', Mb_YesNo or Mb_IconQuestion) = Idyes then
begin
Application.Terminate;
end;
end;
procedure TMain.N14Click(Sender: TObject);
begin
if Application.MessageBox('你确定要退出本系统吗?', '提示', Mb_YesNo or Mb_IconQuestion) = Idyes then
begin
Application.Terminate;
end;
end;
procedure TMain.N3Click(Sender: TObject);
begin
if not Assigned(About_Form) then
begin
About_Form := TAbout_Form.Create(Self);
end;
About_Form.ShowModal;
end;
procedure TMain.Timer1Timer(Sender: TObject);
var
TmpStr1, TmpStr2: string;
begin
TmpStr1 := '当前时间:';
TmpStr2 := FormatDateTime('yyyy-mm-dd-hh-mm-ss', Now());
StatusBar1.Panels[3].Text := TmpStr1 + Copy(TmpStr2, 1, 4) + '年' + Copy(TmpStr2, 6, 2) + '月' + Copy(TmpStr2, 9, 2) + '日' + Copy(TmpStr2, 12, 2) + '时' + Copy(TmpStr2, 15, 2) + '分' + Copy(TmpStr2, 18, 2) + '秒';
end;
procedure TMain.N4Click(Sender: TObject);
begin
if not Assigned(User_Form) then
begin
User_Form := TUser_Form.Create(Self);
end;
User_Form.ShowModal;
end;
procedure TMain.N5Click(Sender: TObject);
begin
if not Assigned(MacInfo_Form) then
begin
Com_Info_Form := TCom_Info_Form.Create(Self);
end;
Com_Info_Form.ShowModal;
end;
procedure TMain.ToolButton1Click(Sender: TObject);
begin
N4.Click;
end;
procedure TMain.ToolButton2Click(Sender: TObject);
begin
N5.Click;
end;
procedure TMain.N6Click(Sender: TObject);
begin
if not Assigned(MacInfo_Form) then
begin
MacInfo_Form := TMacInfo_Form.Create(Self);
end;
MacInfo_Form.ShowModal;
end;
procedure TMain.ToolButton3Click(Sender: TObject);
begin
N6.Click;
end;
procedure TMain.N7Click(Sender: TObject);
begin
if not Assigned(ShopInfo_Form) then
begin
ShopInfo_Form := TShopInfo_Form.Create(Self);
end;
ShopInfo_Form.ShowModal;
end;
procedure TMain.ToolButton4Click(Sender: TObject);
begin
N7.Click;
end;
procedure TMain.N9Click(Sender: TObject);
begin
if not Assigned(BrowBuyInfo_Form) then
begin
BrowBuyInfo_Form := TBrowBuyInfo_Form.Create(Self);
end;
BrowBuyInfo_Form.ShowModal;
end;
procedure TMain.ToolButton5Click(Sender: TObject);
begin
N9.Click;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -