Приложение. Исходный код системы (по модулям).

Модуль 1.

Код данного модуля отвечает за формирование главного окна программы.

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Menus, ToolWin, ComCtrls, Grids, DBGrids, ExtCtrls, StdCtrls,

Buttons, DB, DBTables, INIFiles, ShellAPI;

type

TForm1 = class(TForm)

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

N5: TMenuItem;

N6: TMenuItem;

N7: TMenuItem;

N10: TMenuItem;

N12: TMenuItem;

N13: TMenuItem;

N14: TMenuItem;

N15: TMenuItem;

N16: TMenuItem;

N17: TMenuItem;

N18: TMenuItem;

N20: TMenuItem;

ToolBar1: TToolBar;

DBGrid1: TDBGrid;

Panel1: TPanel;

GroupBox1: TGroupBox;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

GroupBox2: TGroupBox;

BitBtn3: TBitBtn;

BitBtn4: TBitBtn;

GroupBox3: TGroupBox;

BitBtn5: TBitBtn;

BitBtn6: TBitBtn;

dbOlymp: TDatabase;

dsOlymp: TDataSource;

Table1: TTable;

OpenDialog1: TOpenDialog;

Label1: TLabel;

procedure N5Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure N16Click(Sender: TObject);

procedure N2Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure N7Click(Sender: TObject);

procedure N10Click(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure BitBtn4Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

Config:TIniFile;

implementation

uses Unit2, Unit3, Unit4, Unit5, Unit6, Unit7;

{$R *.dfm}

procedure TForm1.N5Click(Sender: TObject);

begin

if Application.MessageBox('Закончить работу?','Выход',mb_YesNo+mb_IconAsterisk)=idYes

then Application.Terminate

else Exit;

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

begin

if Application.MessageBox('Закончить работу?','Выход',mb_YesNo+mb_IconAsterisk)=idYes

then Action:=caFree

else Action:=caNone;

end;

procedure TForm1.N16Click(Sender: TObject);

begin

ShellAbout(Form1.Handle,'FoxSoft Olymps v1.0 (beta)','Programm by Chernetckiy Kirill aka Fox',Application.Icon.Handle);

end;

procedure TForm1.N2Click(Sender: TObject);

begin

Form6.ShowModal;

end;

procedure TForm1.FormCreate(Sender: TObject);

begin

try

with dbOlymp do

begin

Connected:=False;

Params.Clear;

Params.Add('PATH='+GetCurrentDir+'\Bases');

Params.Add('DEFAULT DRIVER=PARADOX');

Params.Add('ENABLE BCD=FALSE');

Connected:=True;

end;

except

Application.MessageBox('Ошибка инициализации баз данных. Возможно не установлен BDE.','Ошибка',mb_Ok+mb_IconHand);

Application.Terminate;

end;

end;

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

Form2.ShowModal;

end;

procedure TForm1.BitBtn2Click(Sender: TObject);

begin

Form3.ShowModal;

end;

procedure TForm1.N7Click(Sender: TObject);

begin

Form4.ShowModal;

end;

procedure TForm1.N10Click(Sender: TObject);

begin

try

if Application.MessageBox('Хотите сохранить текущий вид таблицы?','Подтвердите',mb_YesNo+mb_IconAsterisk)=idNo

then Exit

else

begin

Config:=TIniFile.Create(GetCurrentDir+'\Config.ini');

with Config do

begin

WriteString('GRID_CONFIG','FIO',IntToStr(DBGrid1.Columns[0].Width));

WriteString('GRID_CONFIG','MARK1',IntToStr(DBGrid1.Columns[1].Width));

WriteString('GRID_CONFIG','MARK2',IntToStr(DBGrid1.Columns[2].Width));

Перейти на страницу: 1 2 3 4 5 6