📄 main.pas
字号:
unit Main;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, Menus,
StdCtrls, Dialogs, Buttons, Messages, ExtCtrls, ComCtrls, StdActns,
ActnList, ToolWin, ImgList, RXCtrls, Db, ADODB,IniFiles, WinSkinStore,
WinSkinData, MDITiler, LMDControl, LMDBaseControl, LMDBaseGraphicControl,
LMDBaseLabel, LMDInformationLabel, LMDCustomControl, LMDCustomPanel,
LMDCustomBevelPanel, LMDCustomStatusBar, LMDStatusBar;
type
TMainForm = class(TForm)
MainMenu1: TMainMenu;
Window1: TMenuItem;
Help1: TMenuItem;
WindowCascadeItem: TMenuItem;
WindowTileItem: TMenuItem;
HelpAboutItem: TMenuItem;
OpenDialog: TOpenDialog;
WindowMinimizeItem: TMenuItem;
StatusBar: TStatusBar;
WindowTileItem2: TMenuItem;
ImageList1: TImageList;
Panel1: TPanel;
RSB4: TRxSpeedButton;
RSB3: TRxSpeedButton;
RxSpeedButton2: TRxSpeedButton;
RSB2: TRxSpeedButton;
RSB5: TRxSpeedButton;
RxSB1: TRxSpeedButton;
ImageList3: TImageList;
ADOC: TADOConnection;
Skin: TSkinData;
SkinStore1: TSkinStore;
MDITile: TMDITile;
ActionList1: TActionList;
FileNew1: TAction;
FileOpen1: TAction;
FileClose1: TWindowClose;
FileSave1: TAction;
FileSaveAs1: TAction;
FileExit1: TAction;
EditCut1: TEditCut;
EditCopy1: TEditCopy;
EditPaste1: TEditPaste;
WindowCascade1: TWindowCascade;
WindowTileHorizontal1: TWindowTileHorizontal;
WindowTileVertical1: TWindowTileVertical;
WindowMinimizeAll1: TWindowMinimizeAll;
WindowArrangeAll1: TWindowArrange;
HelpAbout1: TAction;
Timer1: TTimer;
ImageList2: TImageList;
procedure FileNew1Execute(Sender: TObject);
procedure FileOpen1Execute(Sender: TObject);
procedure HelpAbout1Execute(Sender: TObject);
procedure FileExit1Execute(Sender: TObject);
procedure RSB4Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure RxSB1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure RSB5Click(Sender: TObject);
procedure RSB2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure RxSpeedButton2Click(Sender: TObject);
private
{ Private declarations }
procedure CreateMDIChild(const Name: string);
public
{ Public declarations }
end;
var
MainForm: TMainForm;
myinifile:Tinifile;
implementation
{$R *.DFM}
uses ChildWin, About, BKS, YJS, BYSJ,tools, TJBB;
procedure TMainForm.CreateMDIChild(const Name: string);
var
Child: TMDIChild;
begin
{ create a new MDI child window }
Child := TMDIChild.Create(Application);
Child.Caption := Name;
if FileExists(Name) then Child.Memo1.Lines.LoadFromFile(Name);
end;
procedure TMainForm.FileNew1Execute(Sender: TObject);
begin
CreateMDIChild('NONAME' + IntToStr(MDIChildCount + 1));
end;
procedure TMainForm.FileOpen1Execute(Sender: TObject);
begin
if OpenDialog.Execute then
CreateMDIChild(OpenDialog.FileName);
end;
procedure TMainForm.HelpAbout1Execute(Sender: TObject);
begin
if not Assigned(AboutBox) then
AboutBox:= TAboutBox.create(self);
AboutBox.ShowModal;
end;
procedure TMainForm.FileExit1Execute(Sender: TObject);
begin
Close;
end;
procedure TMainForm.RSB4Click(Sender: TObject);
begin
close;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if MessageDlg('关 闭 程 序 吗?',mtConfirmation,[mbYes,mbNo],0) = mrYes then
Action := caFree
else
Action := caNone ;
end;
procedure TMainForm.RxSB1Click(Sender: TObject);
begin
if not Assigned(FBKS) then
FBKS:= TFBKS.create(self);
if FBKS.windowstate <> wsMaximized then
FBKS.windowstate := wsMaximized; //最大化
BringWindowToTop(FBKS.Handle);
end;
procedure TMainForm.FormCreate(Sender: TObject);
var
PubV_ServerName:string;
PubV_SaName:string;
PubV_SaPass:string;
PubV_DatabaseName:string;
skinZT:integer;
begin
skinzt:=strtoint(copy(DateToStr(Date),length(DateToStr(Date)),1));
skin.LoadFromCollection(SkinStore1,skinzt);
MDITile.Bitmap.LoadFromFile(ExtractFileDir(Application.Exename)+'\back.bmp');
myinifile:=Tinifile.create(ExtractFileDir(Application.Exename)+'\config.ini');
PubV_ServerName:=myinifile.Readstring('config','ServerName','');
PubV_SaName:=myinifile.Readstring('config','UserName','sa');
PubV_SaPass:=myinifile.Readstring('config','SaPass','');
PubV_DatabaseName:=myinifile.Readstring('config','DatabaseName','');
mainForm.StatusBar.Panels[1].Text:=myinifile.Readstring('config','Info','');
mainForm.StatusBar.Panels[2].Text := FormatLongDate(date)+' 时间:'+timetostr(time);
try
adoc.ConnectionString:= 'Provider=SQLOLEDB.1;Password='+PubV_SaPass+';Persist Security Info=False;User ID='+PubV_SaName+';Initial Catalog='+PubV_DatabaseName+';Data Source='+PubV_ServerName;
//'Provider=SQLOLEDB.1;Persist Security Info=False;User ID='+PubV_SaName+';Initial Catalog='+PubV_DatabaseName'+;Data Source='+PubV_ServerName+';Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=A0E1EC33E0214F9;Use Encryption for Data=False;Tag with column collation when possible=False'
adoc.Connected:=true;
except
showmessage('数据库连接错误。请检查配置是否正确!');
close;
end;
end;
procedure TMainForm.RSB5Click(Sender: TObject);
begin
if not Assigned(FYJS) then
FYJS:= TFYJS.create(self);
if FYJS.windowstate <> wsMaximized then
FYJS.windowstate := wsMaximized; //最大化
BringWindowToTop(FYJS.Handle);
end;
procedure TMainForm.RSB2Click(Sender: TObject);
begin
if not Assigned(FBYSJ) then
FBYSJ:= TFBYSJ.create(self);
if FBYSJ.windowstate <> wsMaximized then
FBYSJ.windowstate := wsMaximized; //最大化
BringWindowToTop(FBYSJ.Handle);
end;
procedure TMainForm.Timer1Timer(Sender: TObject);
begin
mainForm.StatusBar.Panels[2].Text := FormatLongDate(date)+' 时间:'+timetostr(time);
end;
procedure TMainForm.RxSpeedButton2Click(Sender: TObject);
begin
if not Assigned(FTJBB) then
FTJBB:= TFTJBB.create(self);
if FTJBB.windowstate <> wsMaximized then
FTJBB.windowstate := wsMaximized; //最大化
BringWindowToTop(FTJBB.Handle);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -