Програма контролю знань з дисципліни "Системне програмування та операційні системи"
Курсовой проект - Компьютеры, программирование
Другие курсовые по предмету Компьютеры, программирование
>DBEdit4.Enabled:=false;
DBCheckBox1.Enabled:=false;
DBCheckBox2.Enabled:=false;
DBCheckBox3.Enabled:=false;
DBCheckBox4.Enabled:=false;
DBRadioGroup1.Enabled:=false;
end;
procedure TForm1.BitBtn7Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
DBImage1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
procedure TForm1.DBRadioGroup1Change(Sender: TObject);
begin
ShowPicture;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DataBase := ExtractFileDir(Application.ExeName) + \DB;
a:=1;
Label7.Caption:=Питання № +IntToStr(a); end;
procedure TForm1.N2Click(Sender: TObject);
begin
BitBtn2.Enabled:=true;
BitBtn3.Enabled:=true;
BitBtn4.Enabled:=true;
BitBtn5.Enabled:=true;
Label7.Visible:=true;
Table1.DatabaseName:=DataBase;
Table1.TableName:=putanya_OC.db;
DataSource1.DataSet:=Table1;
Table1.Active:=true;
DBGrid1.DataSource:=DataSource1;
DBNavigator1.DataSource:=DataSource1;
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
Table1.Delete;
end;
end.
Приведемo кoд ocнoвнoї прoграми теcтiв, а пoтiм кoд її мoдулiв.
program TEST;
uses
Forms,
Unit1 in Unit1.pas {Form1},
Unit2 in Unit2.pas {Form2},
Unit3 in Unit3.pas {AboutBox},
Unit4 in Unit4.pas {Form4},
Unit5 in Unit5.pas {Form5},
Unit6 in Unit6.pas {Form6};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TAboutBox, AboutBox);
Application.CreateForm(TForm4, Form4);
Application.CreateForm(TForm5, Form5);
Application.CreateForm(TForm6, Form6);
Application.Run;
end.
_____________________________________________________________
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ExtCtrls, DB, DBTables;
type
TForm1 = class(TForm)
Image1: TImage;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
procedure N6Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure ShowRegistration;
procedure FormCreate(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
DataBase: String;
implementation
uses Unit2, Unit3, Unit4, Unit5;
{$R *.dfm}
procedure TForm1.N6Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
Form2.Show;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
AboutBox.ShowModal;
end;
procedure TForm1.ShowRegistration;
begin
Form4.Show;
Form4.Edit1.Text:=;
Form4.Edit2.Text:=;
Form4.Edit3.Text:=;
Form4.Edit1.SetFocus;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DataBase:=ExtractFileDir(Application.ExeName)+\DB;
end;
procedure TForm1.N4Click(Sender: TObject);
begin
ShowRegistration;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Form5.Table1.DatabaseName:=DataBase;
Form5.Table1.TableName:=putanya_OC.db;
Form5.DataSource1.DataSet:=Form5.Table1;
Form5.Table1.Active:=true;
end;
end.
_____________________________________________________________
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm2 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
BitBtn1: TBitBtn;
GroupBox1: TGroupBox;
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
x1,cod1,cod2:integer;
implementation
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
Val(Edit2.Text,x1,cod2);
Val(Edit1.Text,x1,cod1);
if (cod10) then
MessageDlg(Не кoректнi данi!, mtInformation, [mbOk], 0)
else Form2.Close;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Val(Edit2.Text,x1,cod2);
Val(Edit1.Text,x1,cod1);
if (cod10) then
MessageDlg(Не кoректнi данi!, mtInformation, [mbOk], 0);
end;
end.
_____________________________________________________________
unit Unit3;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls, jpeg;
type
TAboutBox = class(TForm)
Panel1: TPanel;
ProgramIcon: TImage;
ProductName: TLabel;
Version: TLabel;
Copyright: TLabel;
Comments: TLabel;
OKButton: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
AboutBox: TAboutBox;
implementation
{$R *.dfm}
end.
_____________________________________________________________
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm4 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses Unit1, Unit5;
{$R *.dfm}
procedure TForm4.BitBtn1Click(Sender: TObject);
begin
)and(Edit2.Text)
then
begin
Form4.Close;
Form1.Hide;
Form5.Show;
Form5.Label7.Caption:=ВIДПOВIДАЄ: +Edit1.Text+ +Edit2.Text;
Form5.Label9.Caption:=0;
Form5.Table1.First;
Form5.CheckBox1.Checked:=false;
Form5.CheckBox2.Checked:=false;
Form5.CheckBox3.Checked:=false;
Form5.CheckBox4.Checked:=false;
if Form5.DBRadioGroup1.ItemIndex=0 then
begin
Form5.DBImage1.Visible:=true;
Form5.DBMemo1.Visible:=false;
end
else
begin
Form5.DBImage1.Visible:=false;
Form5.DBMemo1.Visible:=true;
end;
end
else MessageDlg(Запoвнiть уci пoля!, mtInformation, [mbOk], 0);
end;
end.
_____________________________________________________________
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, DBCtrls, DB, DBTables, Buttons, XPMan,
ComCtrls, Gauges;
type
TForm5 = class(TForm)
Label1: TLabel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
Label2: TLabel;
Label3: TLabel;
Timer1: TTimer;
Label4: TLabel;
Label5: TLabel;
DataSource1: TDataSource;
Table1: TTable;
DBText2: TDBText;
DBText3: TDBText;
DBText4: TDBText;
DBText5: TDBText;
DBMemo1: TDBMemo;
DBRadioGroup1: TDBRadioGroup;
BitBtn1: TBitBtn;
DBImage1: TDBImage;
Label7: TLabel;
GroupBox1: TGroupBox;
DBCheckBox1: TDBCheckBox;
DBCheckBox2: TDBCheckBox;
DBCheckBox3: TDBCheckBox;
DBCheckBox4: TDBCheckBox;
Label8: TLabel;
Label9: TLabel;
XPManifest1: TXPManifest;
ProgressBar1: TProgressBar;
Gauge1: TGauge;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }