【源码结构】
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxWinXPBar, dxCore, dxContainer, ExtCtrls, ImgList, StdCtrls,
Buttons, ComCtrls;
type
TFrmMain = class(TForm)
Splitter1: TSplitter;
ImageList1: TImageList;
dxContainer1: TdxContainer;
ScrollBox1: TScrollBox;
dxContainer3: TdxContainer;
BBaseSetup: TdxWinXPBar;
dxContainer2: TdxContainer;
BInOut: TdxWinXPBar;
dxContainer4: TdxContainer;
BHelp: TdxWinXPBar;
dxCRight: TdxContainer;
dxContainer6: TdxContainer;
LblAppVer1: TLabel;
LblAppVer2: TLabel;
procedure BHelpItems2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BBaseSetupItems0Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure BBaseSetupItems1Click(Sender: TObject);
procedure BBaseSetupItems2Click(Sender: TObject);
procedure BHelpItems1Click(Sender: TObject);
procedure BInOutItems0Click(Sender: TObject);
procedure BInOutItems1Click(Sender: TObject);
procedure BInOutItems2Click(Sender: TObject);
procedure BInOutItems3Click(Sender: TObject);
procedure BHelpItems0Click(Sender: TObject);
private
{ Private declarations }
//窗体停靠 (融合)
procedure CreateDockChild(Fname: string; Fclass: TFormClass);
public
{ Public declarations }
end;
var
FrmMain: TFrmMain;
implementation
uses global,ddm,login,pwdsetup,BaseSetup,about,NowInsurance,
NowInsuranceStaff,InInsurance,OutInSurance,InOutTj,help;
{$R *.dfm}
procedure TFrmMain.BHelpItems2Click(Sender: TObject);
begin
close;
end;
procedure TFrmMain.FormCreate(Sender: TObject);
begin
//DeleteMenu(GetSystemMenu(Handle, False), SC_CLOSE, MF_BYCOMMAND);
LblAppVer1.Caption :=SAppVersion;
lblAppVer2.Caption :=SAppVersion;
BBaseSetup.Items[1].Visible :=False;
BBaseSetup.Items[2].Visible :=False;
BInOut.Visible:=False;
Caption:=SAppName;
end;
procedure TFrmMain.BBaseSetupItems0Click(Sender: TObject);
begin
BBaseSetup.Items[0].Enabled :=False;
CreateDockChild('login',TLoginFrm);
end;
procedure TFrmMain.FormActivate(Sender: TObject);
var AutoLogin:boolean;
begin
with dm.AQ1 do
begin
Close;
SQL.Clear;
SQL.Text :=format(SSQL_Current,[STableBaseSetup]);
Open;
pwd :=FieldValues[SFieldLoginPwd];
AutoLogin:=FieldValues[SFieldPwdProtect];
Close;
end;
if AutoLogin then
begin
BBaseSetup.Items[0].Visible :=False;
BBaseSetup.Items[1].Visible :=True;
BBaseSetup.Items[2].Visible :=True;
BHelp.Visible:=False;
BInOut.Visible:=True;
BHelp.Visible:=True;
end;
end;
//窗体停靠 (融合)
procedure TFrmMain.CreateDockChild(Fname: string; Fclass: TFormClass);
var Fform: TForm;
begin
if Application.FindComponent(fname) = nil then
begin
Fform := Fclass.Create(Application);
with Fform do
begin
WindowState :=wsMaximized ;
BorderStyle := bsNone;
Parent :=dxCRight;
Align := alClient;
Show;
end;
end
else
with TForm(Application.FindComponent(Fname)) do BringToFront;
end;
procedure TFrmMain.BBaseSetupItems1Click(Sender: TObject);
begin
BBaseSetup.Items[1].Enabled :=False;
CreateDockChild('PwdSetup',TPwdSetupFrm);
end;
procedure TFrmMain.BBaseSetupItems2Click(Sender: TObject);
begin
BBaseSetup.Items[2].Enabled :=False;
CreateDockChild('BaseSetup',TBaseSetupFrm);
end;
procedure TFrmMain.BHelpItems1Click(Sender: TObject);
begin
BHelp.Items[1].Enabled :=False;
CreateDockChild('About',TAboutFrm);
end;
procedure TFrmMain.BInOutItems0Click(Sender: TObject);
begin
BinOut.Items[0].Enabled :=False;
CreateDockChild('NowInsuranceStaff',TNowInsuranceStaffFrm);
// CreateDockChild('NowInsurance',TNowInsuranceFrm);
end;
procedure TFrmMain.BInOutItems1Click(Sender: TObject);
begin
BinOut.Items[1].Enabled :=False;
CreateDockChild('InInsurance',TInInsuranceFrm);
end;
procedure TFrmMain.BInOutItems2Click(Sender: TObject);
begin
BinOut.Items[2].Enabled :=False;
CreateDockChild('OutInSurance',TOutInSuranceFrm);
end;
procedure TFrmMain.BInOutItems3Click(Sender: TObject);
begin
BinOut.Items[3].Enabled :=False;
CreateDockChild('InOutTJ',TInOutTJFrm);
end;
procedure TFrmMain.BHelpItems0Click(Sender: TObject);
begin
BHelp.Items[0].Enabled :=False;
CreateDockChild('Help',THelpFrm);
end;
end.
评论