?? main.~pas
字號:
f_khdh.Free;
end;
31: begin
Application.CreateForm(Tf_cgjhbb,f_cgjhbb);
Formcaption := f_cgjhbb.Caption ;
f_cgjhbb.ShowModal;
f_cgjhbb.Free;
end;
32: begin
Application.CreateForm(Tf_cgthbb,f_cgthbb);
Formcaption := f_cgthbb.Caption ;
f_cgthbb.ShowModal;
f_cgthbb.Free;
end;
33: begin
Application.CreateForm(Tf_spbsbb,f_spbsbb);
Formcaption := f_spbsbb.Caption ;
f_spbsbb.ShowModal;
f_spbsbb.Free;
end;
34: begin
Application.CreateForm(Tf_spbybb,f_spbybb);
Formcaption := f_spbybb.Caption ;
f_spbybb.ShowModal;
f_spbybb.Free;
end;
35: begin
Application.CreateForm(Tf_spxsbb,f_spxsbb);
Formcaption := f_spxsbb.Caption ;
f_spxsbb.ShowModal;
f_spxsbb.Free;
end;
36: begin
Application.CreateForm(Tf_xsthbb,f_xsthbb);
Formcaption := f_xsthbb.Caption ;
f_xsthbb.ShowModal;
f_xsthbb.Free;
end;
37: begin
Application.CreateForm(Tf_khdhbb,f_khdhbb);
Formcaption := f_khdhbb.Caption ;
f_khdhbb.ShowModal;
f_khdhbb.Free;
end;
38: begin
Application.CreateForm(Tf_csjkbb,f_csjkbb);
Formcaption := f_csjkbb.Caption ;
f_csjkbb.ShowModal;
f_csjkbb.Free;
end;
39: begin
Application.CreateForm(Tf_csyfkbb,f_csyfkbb);
Formcaption := f_csyfkbb.Caption ;
f_csyfkbb.ShowModal;
f_csyfkbb.Free;
end;
40: begin
Application.CreateForm(Tf_khjkbb,f_khjkbb);
Formcaption := f_khjkbb.Caption ;
f_khjkbb.ShowModal;
f_khjkbb.Free;
end;
41: begin
Application.CreateForm(Tf_khyfkbb,f_khyfkbb);
Formcaption := f_khyfkbb.Caption ;
f_khyfkbb.ShowModal;
f_khyfkbb.Free;
end;
42: begin
if czyxx.lrfx = 0 then
begin
Application.CreateForm(Tf_lrfx,f_lrfx);
Formcaption := f_lrfx.Caption ;
f_lrfx.ShowModal;
f_lrfx.Free;
end
else
Application.MessageBox('操作員沒有該權(quán)限.','提示',64);
end;
43: begin
Application.CreateForm(Tf_cqyskbb,f_cqyskbb);
Formcaption := f_cqyskbb.Caption ;
f_cqyskbb.ShowModal;
f_cqyskbb.Free;
end;
44: begin
Application.CreateForm(Tf_cqyfkbb,f_cqyfkbb);
Formcaption := f_cqyfkbb.Caption ;
f_cqyfkbb.ShowModal;
f_cqyfkbb.Free;
end;
45: begin
if czyxx.czyjb = '系統(tǒng)管理員' then
begin
Application.CreateForm(Tf_czygl,f_czygl);
Formcaption := f_czygl.Caption ;
f_czygl.ShowModal;
f_czygl.Free;
end
else
Application.MessageBox('操作員沒有該權(quán)限.','提示',64);
end;
46: begin
Application.CreateForm(Tf_sjbf,f_sjbf);
Formcaption := f_sjbf.Caption ;
f_sjbf.ShowModal;
f_sjbf.Free;
end;
47: begin
Application.CreateForm(Tf_sjhy,f_sjhy);
Formcaption := f_sjhy.Caption ;
f_sjhy.ShowModal;
f_sjhy.Free;
end;
48: begin
Application.CreateForm(Tf_csh,f_csh);
Formcaption := f_csh.Caption ;
f_csh.ShowModal;
f_csh.Free;
end;
49: begin
Application.CreateForm(Tf_dldw,f_dldw);
Formcaption := f_dldw.Caption ;
f_dldw.ShowModal;
f_dldw.Free;
end;
end;
//在打開一個(gè)窗口時(shí),在最近使用的窗體菜單中會(huì)進(jìn)行記錄
if RecentForm.Count<6 then
begin
if IsExists(Index) = False then
AddMenu(Formcaption,SelectedTag)
else
RecentForm.Items[Index].MenuIndex := 0;
end
else
begin
if IsExists(Index) = False then
begin
if Trim(FormCaption)<>'' then
begin
RecentForm.Items[5].Caption := FormCaption;
RecentForm.Items[5].Tag := SelectedTag;
RecentForm.Items[5].MenuIndex := 0;
end;
end
else
RecentForm.Items[Index].MenuIndex := 0;
end;
end;
procedure Tf_Main.FormShow(Sender: TObject);
begin
n2.OnClick(Sender); //調(diào)用系統(tǒng)登錄
StatusBar1.Panels[5].Text := FormatDateTime('yyyy-mm-dd',Now);
//設(shè)置最近使用的窗體
with Data.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_RecentForm');
Open;
end;
if Data.Query1.RecordCount>0 then
begin
while Not Data.Query1.Eof do
begin
AddMenu(Trim(Data.Query1.Fields[0].AsString),Data.Query1.Fields[1].AsInteger);
Data.Query1.Next;
end;
end;
SetMyLove;
//使窗體以特殊效果顯示出來
if m = True then
AnimateWindow(Handle,800,AW_HOR_NEGATIVE+AW_ACTIVATE+AW_CENTER);
end;
procedure Tf_Main.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
i: Integer;
begin
if Application.MessageBox('確實(shí)要退出系統(tǒng)嗎?','提示',mb_YesNo) = Id_Yes then
begin
if RecentForm.Count>0 then
begin
Try
Data.Database.StartTransaction;
with Data.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('Delete t_recentform ');
ExecSQL;
end;
For i := 0 to RecentForm.Count-1 do
begin
with Data.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('Insert t_recentform values (:a,:b)');
ParamByName('a').AsString := Trim(RecentForm.Items[i].Caption);
ParamByName('b').AsInteger := TMenuItem(RecentForm.Items[i]).Tag;
ExecSQL;
end;
end;
Data.Database.Commit;
Except
Data.Database.Rollback;
Application.MessageBox('系統(tǒng)出錯(cuò).','提示',64);
End;
end;
AnimateWindow(Handle,800,AW_HOR_NEGATIVE+AW_HIDE+AW_CENTER);
CanClose := True;
end
else
CanClose := False;
end;
procedure Tf_Main.AddMenu(Caption: String;Tag: Integer);
begin
if Trim(Caption)<>'' then
begin
MenuItem1 := TMenuItem.Create(Nil);
MenuItem1.Caption := Caption;
MenuItem1.ImageIndex := 3;
RecentForm.Insert(0,MenuItem1);
MenuItem1.Tag := Tag;
MenuItem1.OnClick := MenuClick;
end;
end;
procedure Tf_Main.MenuClick(Sender: TObject);
begin
if Sender is TMenuItem then
begin
SelectedTag := TMenuItem(Sender).Tag;
TreeView1.OnDblClick(Sender);
end;
end;
function Tf_Main.IsExists(Var Index: Integer): Boolean;
var
i: Integer;
begin
Index := -1;
Result := False;
For i := 0 to RecentForm.Count-1 do
begin
if RecentForm.Items[i].Tag = SelectedTag then
begin
Result := True;
Index := i;
Break;
end;
end;
end;
procedure Tf_Main.TreeView1Click(Sender: TObject);
begin
SelectedTag := -2;
if Treeview1.Selected<>Nil then
if (TreeView1.Selected.Level=2)or(TreeView1.Selected.Level=3) then
SelectedTag := TreeView1.Selected.StateIndex;
end;
procedure Tf_Main.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
//77為M的ASCII碼
if (Key = 77)and(Shift =[ssCtrl] ) then
begin
Application.CreateForm(Tf_mylove,f_mylove);
f_mylove.ShowModal;
f_mylove.Free;
end
else if key = VK_ESCAPE then
Close
else if key = vk_F1 then
N10.OnClick(Sender);
end;
procedure Tf_Main.myloveAddMenu(Caption: String; Tag: Integer);
begin
MenuItem1 := TMenuItem.Create(Nil);
MenuItem1.Caption := Caption;
MenuItem1.ImageIndex := 4;
Mylove.Insert(0,MenuItem1);
MenuItem1.Tag := Tag;
MenuItem1.OnClick := MenuClick;
end;
procedure Tf_Main.Setmylove;
begin
mylove.Clear;
with Data.Query1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from t_LoveForm where disform = 1');
Open;
end;
if Data.Query1.RecordCount>0 then
begin
while Not Data.Query1.Eof do
begin
MyLoveAddMenu(Trim(Data.Query1.Fields[0].AsString),Data.Query1.Fields[1].AsInteger);
Data.Query1.Next;
end;
end;
end;
procedure Tf_Main.FormCanResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
StatusBar1.Refresh;
end;
procedure Tf_Main.N2Click(Sender: TObject);
begin
Application.CreateForm(Tf_xtdl,f_xtdl);
f_xtdl.ShowModal;
f_xtdl.Free;
end;
procedure Tf_Main.ToolButton2Click(Sender: TObject);
begin
Close;
end;
procedure Tf_Main.ToolButton3Click(Sender: TObject);
begin
//用戶單擊工具欄中的按鈕,程序通過調(diào)用樹視圖控件的
//雙擊事件打開相應(yīng)的窗體
if Sender is TToolButton then
begin
Case TToolButton(Sender).Tag of
3: SelectedTag := 30;
4: SelectedTag := 35;
5: SelectedTag := 13;
6: SelectedTag := 19;
7: SelectedTag := 20;
8: SelectedTag := 46;
End;
TreeView1.OnDblClick(Sender);
end;
end;
procedure Tf_Main.ToolButton1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if Sender is TToolButton then
begin
Case TToolButton(Sender).Tag of
1: StatusBar1.Panels[1].Text := '系統(tǒng)登錄';
2: StatusBar1.Panels[1].Text := '系統(tǒng)退出';
3: StatusBar1.Panels[1].Text := '客戶訂貨';
4: StatusBar1.Panels[1].Text := '銷售查詢';
5: StatusBar1.Panels[1].Text := '采購進(jìn)貨';
6: StatusBar1.Panels[1].Text := '商品銷售';
7: StatusBar1.Panels[1].Text := '銷售退貨';
8: StatusBar1.Panels[1].Text := '數(shù)據(jù)備份';
End;
end;
end;
procedure Tf_Main.TreeView1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
StatusBar1.Panels[1].Text := '';
end;
procedure Tf_Main.N10Click(Sender: TObject);
begin
//調(diào)出幫助文件
Application.HelpCommand(HELP_FINDER,0);
end;
procedure Tf_Main.N3Click(Sender: TObject);
begin
Application.CreateForm(Tf_jsq,f_jsq);
f_jsq.ShowModal;
f_jsq.Free;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -