«Калькулятор на андройд» по специальности 1304000 «Вычислительная техника и программное обеспечение» мамандығы бойынша



бет27/27
Дата09.10.2022
өлшемі1,01 Mb.
#152305
1   ...   19   20   21   22   23   24   25   26   27
Байланысты:
Пояснительная записка
форма соц паспорта

ПРИЛОЖЕНИЕ А – ЛИСТИНГ ПРОГРАММЫ


Листинг Form1
var
Form1: TForm1;
LanguageIniFile :TIniFile;
DefaultLanguage :string;
ProgramPath :string;
procedure TForm1.Button2Click(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
if MessageDlg('Перед закрытием программы убедитесь, что вы завершили свою работу! Закрыть программу?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Application.Terminate;
end;
end
else
if MessageDlg('Before closing the program, make sure you have completed your work! Close the program?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Application.Terminate;
end;
end;
procedure TForm1.ChangLanguage(Langselection: string);
var
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
LanguageIniFile.WriteString('MAIN', 'default', Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TButton then
begin
(Components[i-1] as TButton).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TButton).Caption);
LanguageIniFile.WriteString('MAIN','default',DefaultLanguage);
if DefaultLanguage = 'RUSSIAN' then
begin
Form1.N1.Caption := 'Язык';
Form1.N6.Caption := 'Разное';
Form1.N7.Caption := 'Свернуть все окна';
Form1.N8.Caption := 'Развернуть все окна';
Form1.N10.Caption := 'Закрыть все окна';
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form1.N1.Caption := 'Language';
Form1.N6.Caption := 'Other';
Form1.N7.Caption := 'Minimize all Windows';
Form1.N8.Caption := 'Expand all Windows';
Form1.N10.Caption := 'Close all Windows';
end;
end;
end;
end;
LanguageIniFile.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Show;
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
DefaultLanguage := LanguageIniFile.ReadString('MAIN', 'default', DefaultLanguage);
if DefaultLanguage = 'RUSSIAN' then
begin
Form1.ChangLanguage('RUSSIAN');
Form1.N2.Enabled := false;
Form1.N3.Enabled := true;
Form1.N1.Caption := 'Язык';
Form1.N6.Caption := 'Разное';
Form1.N7.Caption := 'Свернуть все окна';
Form1.N8.Caption := 'Развернуть все окна';
Form1.N10.Caption := 'Закрыть все окна';
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form1.ChangLanguage('ENGLISH');
Form1.N2.Enabled := true;
Form1.N3.Enabled := false;
Form1.N1.Caption := 'Language';
Form1.N6.Caption := 'Other';
Form1.N7.Caption := 'Minimize all Windows';
Form1.N8.Caption := 'Expand all Windows';
Form1.N10.Caption := 'Close all Windows';
end;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
if DefaultLanguage = 'ENGLISH' then
begin
if MessageDlg('Attention! The program will automatically restart to successfully complete the language change. Continue?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form1.ChangLanguage('RUSSIAN');
ShellExecute(Handle,'open',PChar('Restart.bat'),nil,nil,0);
Application.Terminate;
end
else
if MessageDlg('ВНИМАНИЕ! Программа автоматически перезапуститься для успешного завершения смены языка. Продолжить?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form1.ChangLanguage('RUSSIAN');
ShellExecute(Handle,'open',PChar('Restart.bat'),nil,nil,0);
Application.Terminate;
end;
end;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
if MessageDlg('ВНИМАНИЕ! Программа автоматически перезапуститься для успешного завершения смены языка. Продолжить?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form1.ChangLanguage('ENGLISH');
ShellExecute(Handle,'open',PChar('Restart.bat'),nil,nil,0);
Application.Terminate;
end
else
if MessageDlg('Attention! The program will automatically restart to successfully complete the language change. Continue?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form1.ChangLanguage('ENGLISH');
ShellExecute(Handle,'open',PChar('Restart.bat'),nil,nil,0);
Application.Terminate;
end;
end;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
Form2.WindowState := wsMinimized;
Form3.WindowState := wsMinimized;
Form4.WindowState := wsMinimized;
Form5.WindowState := wsMinimized;
Form6.WindowState := wsMinimized;
Form7.WindowState := wsMinimized;
Form8.WindowState := wsMinimized;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
Form2.WindowState := wsNormal;
Form3.WindowState := wsNormal;
Form4.WindowState := wsNormal;
Form5.WindowState := wsNormal;
Form6.WindowState := wsNormal;
Form7.WindowState := wsNormal;
Form8.WindowState := wsNormal;
end;
end.

Листинг Form2


procedure TForm2.ADOTable1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
var
s1,s2,s3 :string;
begin
if Form5.RadioGroup1.ItemIndex = 0 then
begin
s1 := Copy(DataSet['Фамилия'], 1, Length(Form5.Edit1.Text));
Accept := s1 = Form5.Edit1.Text;
end;
if Form5.RadioGroup1.ItemIndex = 1 then
begin
s2 := Copy(DataSet['Имя'], 1, Length(Form5.Edit1.Text));
Accept := s2 = Form5.Edit1.Text;
end;
if Form5.RadioGroup1.ItemIndex = 2 then
begin
s3 := Copy(DataSet['Отчество'], 1, Length(Form5.Edit1.Text));
Accept := s3 = Form5.Edit1.Text;
end;
end;
procedure TForm2.Button10Click(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
if MessageDlg('Вы точно хотите удалить запись? После удаления запись не восстановить!', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form2.ADOTable2.Delete;
Form2.ADOTable1.Delete;
if Form3.DBText1.Caption = '' then
Form3.Close;
end
end
else
if MessageDlg('Are you sure you want to delete the record? After removing the record is not restored!', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form2.ADOTable2.Delete;
Form2.ADOTable1.Delete;
if Form3.DBText1.Caption = '' then
Form3.Close;
end;
end;
procedure TForm2.Button11Click(Sender: TObject);
begin
Form5.Show;
Form5.RadioGroup1.ItemIndex := -1;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
Form3.Panel2.BringToFront;
if DefaultLanguage = 'RUSSIAN' then
Form3.Caption := 'Информация о преподавателе'
else
Form3.Caption := 'Information about the teacher';
Form3.Close;
Form3.Show;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
Form3.Show;
Form3.Button30.Visible := false;
Form3.Button31.Visible := false;
Form3.Panel1.BringToFront;
Form3.Panel2.SendToBack;
Form2.ADOTable2.Edit;
Form2.Timer1.Enabled := false;
EnableButtonFalse;
if DefaultLanguage = 'RUSSIAN' then
Form3.Caption := 'Редактирование преподавателя'
else
Form3.Caption := 'To edit a teacher';
if Form3.DBComboBox3.Text = 'Да' then
Form3.DBEdit6.Enabled := true
else
Form3.DBEdit6.Enabled := false;
end;
procedure TForm2.Button3Click(Sender: TObject);
begin
Form1.Enabled := false;
Form2.Enabled := false;
Form4.Show;
Form2.ADOTable1.Last;
Form2.ADOTable1.Insert;
end;
procedure TForm2.DBGrid1TitleClick(Column: TColumn);
var f:string;
begin
f := Column.FieldName;
if ADOTable1.Sort = f + ' ASC' then
ADOTable1.Sort := f + ' DESC'
else
ADOTable1.Sort := f + ' ASC';
end;
procedure TForm2.FormShow(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
Form2.ChangLanguage2('RUSSIAN');
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form2.ChangLanguage2('ENGLISH');
end;
end;
procedure TForm2.ChangLanguage2(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TButton then
(Components[i-1] as TButton).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TButton).Caption);
end;
end;
LanguageIniFile.Free;
end;
end.

Листинг Form3


var
Form3: TForm3;
x1,x11,x2,x22,y1,y11,y2,y22,x3,x33,x4,x44,y3,y33,y4,y44 : integer;
xx1,xx11,xx2,xx22,xx3,xx33,xx4,xx44,yy1,yy11,yy2,yy22,yy3,yy33,yy4,yy44 :integer;
xxx1,xxx11,xxx2,xxx22,xxx3,xxx33,xxx4,xxx44,yyy1,yyy11,yyy2,yyy22,yyy3,yyy33,yyy4,yyy44 :integer;
s1,s2,s3,s4 :integer;
jpeg: TJPEGImage;
bmp: TBitmap;
EditTeacherCloseRU,EditTeacherCloseEN :string;
procedure TForm3.Button10Click(Sender: TObject);
begin
Form2.Button7Click(sender);
end;
procedure TForm3.Button12Click(Sender: TObject);
begin
Form2.Button10Click(sender);
if DBText1.Caption = '' then
Form3.Close;
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
if MessageDlg(EditTeacherCloseRU, mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
if Form2.Timer1.Enabled = false then
begin
Form2.Timer1.Enabled := true;
Form2.EnableButtonTrue;
end;
Form3.DBEdit4.Text := DateToStr(DateTimePicker1.Date);
Form2.ADOTable2.Post;
Form1.Enabled := true;
Form2.Enabled := true;
Form4.Button1.Enabled := false;
Form3.Close;
end;
end
else
if MessageDlg(EditTeacherCloseEN, mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
if Form2.Timer1.Enabled = false then
begin
Form2.Timer1.Enabled := true;
Form2.EnableButtonTrue;
end;
Form3.DBEdit4.Text := DateToStr(DateTimePicker1.Date);
Form2.ADOTable2.Post;
Form1.Enabled := true;
Form2.Enabled := true;
Form4.Button1.Enabled := false;
Form3.Close;
end;
end;
procedure TForm3.Button22Click(Sender: TObject);
begin
Form6.Image1.Picture.Assign(Form3.DBImage1.Picture.Graphic);
if Form6.Image1.Picture.Width = 0 then
begin
MessageDlg('No image!', mtInformation, [mbYES], 0);
end
else
Form6.Show;
Form6.AutoSize := false;
Form6.AutoSize := true;
end;
procedure TForm3.Button23Click(Sender: TObject);
begin
Form6.Image1.Picture.Assign(Form3.DBImage4.Picture.Graphic);
if Form6.Image1.Picture.Width = 0 then
begin
MessageDlg('No image!', mtInformation, [mbYES], 0);
end
else
Form6.Show;
Form6.AutoSize := false;
Form6.AutoSize := true;
end;
procedure TForm3.Button24Click(Sender: TObject);
const
wdAlignParagraphCenter = 1;
wdAlignParagraphLeft = 0;
var
wdApp, wdDoc, wdRng: Variant;
vstart, vend, i: integer;
FileName: string;
LinkToFile, SaveWithDocument: boolean;
PathToImage :string;
begin
try
wdApp := CreateOleObject('Word.Application');
except
Exception.Create('Error#1: Failed to create ms word document');
Exit;
end;
wdApp.Visible := True;
wdDoc := wdApp.Documents.Add;
//Отключение перерисовки окна MS Word. - Для ускорения работы.
wdApp.ScreenUpdating := False;
try
wdRng := wdDoc.Range;
wdRng.Font.Name := 'Times New Roman';
wdRng.Font.Bold := True;
wdRng.Font.Size := 14;
wdRng.ParagraphFormat.LineUnitAfter := 0.05;
wdRng.ParagraphFormat.LineUnitBefore := 0.05;
wdRng.ParagraphFormat.Alignment := wdAlignParagraphCenter;
wdApp.Selection.TypeText('РЕЗЮМЕ');
wdApp.Selection.TypeText(''#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10#13#10);
wdApp.Selection.Font.Bold := false;
wdRng.Start := wdRng.End;
wdRng.ParagraphFormat.Alignment := wdAlignParagraphLeft;
wdRng.Start := wdRng.End;
if DBImage1.Picture.Graphic.Empty = false then
begin
DBImage1.Picture.SavetoFile('qwe.jpg');
ProgramPath := ExtractFileDir(Application.ExeName);
PathToImage := ProgramPath;
wdDoc.Shapes.AddPicture(FileName := PathToImage + '\qwe.jpg',
LinkToFile := False,SaveWithDocument := True,
Left := 0, Top := 30,
Width := DBImage1.Width,
Height := DBImage1.Height);
DeleteFile('qwe.jpg');
end;
if DBImage4.Picture.Graphic.Empty = false then
begin
DBImage4.Picture.SavetoFile('asd.jpg');
ProgramPath := ExtractFileDir(Application.ExeName);
PathToImage := ProgramPath;
wdDoc.Shapes.AddPicture(FileName := PathToImage + '\asd.jpg',
LinkToFile := False,SaveWithDocument := True,
Left := 250, Top := 30,
Width := DBImage4.Width,
Height := DBImage4.Height);
DeleteFile('asd.jpg');
end;
// фамилия
wdApp.Selection.Font.Size := 12;
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label4.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText1.Caption);
wdApp.Selection.TypeText(#13#10);
// имя
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label5.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText2.Caption);
wdApp.Selection.TypeText(#13#10);
// отчество
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label6.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText3.Caption);
wdApp.Selection.TypeText(#13#10);
// дата рождения
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label7.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText4.Caption);
wdApp.Selection.TypeText(#13#10);
// место проживания
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label26.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText12.Caption);
wdApp.Selection.TypeText(#13#10);
// семейное положение
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label8.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText5.Caption);
wdApp.Selection.TypeText(#13#10);
// квалификационная категория
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label14.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText10.Caption);
wdApp.Selection.TypeText(#13#10);
// квалификационная категория - год
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label34.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText8.Caption);
wdApp.Selection.TypeText(#13#10);
// должность
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label25.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBMemo8.Text);
wdApp.Selection.TypeText(#13#10);
// стаж работы
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label18.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBMemo9.Text);
wdApp.Selection.TypeText(#13#10);
// является куратором
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label28.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText6.Caption);
wdApp.Selection.TypeText(#13#10);
// закрепленная группа
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label29.Caption + ' ');
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBText7.Caption);
wdApp.Selection.TypeText(#13#10#13#10);
// преподаваемая дисциплина
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label35.Caption + #13#10);
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBMemo11.Text);
wdApp.Selection.TypeText(#13#10#13#10);
// образование
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label10.Caption + #13#10);
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBMemo5.Text);
wdApp.Selection.TypeText(#13#10#13#10);
// повышение квалификации
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label20.Caption + #13#10);
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBMemo7.Text);
wdApp.Selection.TypeText(#13#10#13#10);
// награды
wdApp.Selection.Font.Bold := 1;
wdApp.Selection.TypeText(Label36.Caption + #13#10);
wdApp.Selection.Font.Bold := 0;
wdApp.Selection.TypeText(DBMemo12.Text);
finally
wdApp.ScreenUpdating := True;
end;
end;
procedure TForm3.Button31Click(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
if MessageDlg('Вы точно хотите отменить добавление преподавателя в базу?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form2.ADOTable2.Delete;
Form2.ADOTable1.Delete;
Form3.Close;
end;
end;
if DefaultLanguage = 'ENGLISH' then
begin
if MessageDlg('Are you sure you want to cancel adding a teacher to the database?', mtConfirmation, [mbYES,mbNO], 0) = mrYes then
begin
Form2.ADOTable2.Delete;
Form2.ADOTable1.Delete;
Form3.Close;
end;
end;
end;
procedure TForm3.Button5Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
begin
jpeg := TJPEGImage.Create;
bmp := TBitmap.Create;
try
jpeg.LoadFromFile(OpenPictureDialog1.FileName);
bmp.Assign(jpeg);
Form2.ADOTable2.Edit; // режим редактирования
Form2.ADOTable2.FieldByName('Фото').Assign(bmp);//загрузка фото
finally
jpeg.Free;
bmp.Free;
end;
end;
end;
procedure TForm3.Button6Click(Sender: TObject);
var
jpeg: TJPEGImage;
bmp: TBitmap;
begin
if OpenPictureDialog1.Execute then
begin
jpeg := TJPEGImage.Create;
bmp := TBitmap.Create;
try
jpeg.LoadFromFile(OpenPictureDialog1.FileName);
bmp.Assign(jpeg);
Form2.ADOTable2.Edit; // режим редактирования
Form2.ADOTable2.FieldByName('Фото УД').Assign(bmp);//загрузка фото
finally
jpeg.Free;
bmp.Free;
end;
end;
end;
procedure TForm3.Button8Click(Sender: TObject);
begin
Form2.Button8Click(sender);
end;
procedure TForm3.DBComboBox3Change(Sender: TObject);
begin
if DBComboBox3.Text = 'Да' then
DBEdit6.Enabled := true
else
DBEdit6.Enabled := false;
if DBComboBox3.Text = 'Нет' then
DBEdit6.Text := 'Нету';
end;
procedure TForm3.DBMemo10Click(Sender: TObject);
begin
DBMemo10.BringToFront;
Button13.BringToFront;
xxx11 := 301;
yyy11 := 196;
DBMemo10.Width := xxx11;
DBMemo10.Height := yyy11;
Button13.Visible := true;
end;
procedure TForm3.DBMemo1Click(Sender: TObject);
begin
DBMemo1.BringToFront;
Button13.BringToFront;
x11 := 301;
y11 := 316;
DBMemo1.Width := x11;
DBMemo1.Height := y11;
Button13.Visible := true;
end;
procedure TForm3.DBMemo2Click(Sender: TObject);
begin
DBMemo2.BringToFront;
Button13.BringToFront;
x22 := 301;
y22 := 268;
DBMemo2.Width := x22;
DBMemo2.Height := y22;
Button13.Visible := true;
end;
procedure TForm3.DBMemo3Click(Sender: TObject);
begin
DBMemo3.BringToFront;
Button13.BringToFront;
xxx22 := 301;
yyy22 := 220;
DBMemo3.Width := xxx22;
DBMemo3.Height := yyy22;
Button13.Visible := true;
end;
procedure TForm3.DBMemo4Click(Sender: TObject);
begin
DBMemo4.BringToFront;
Button13.BringToFront;
xxx11 := 301;
yyy11 := 172;
DBMemo4.Width := xxx11;
DBMemo4.Height := yyy11;
Button13.Visible := true;
end;
procedure TForm3.DBMemo6Click(Sender: TObject);
begin
DBMemo6.BringToFront;
Button13.BringToFront;
xxx11 := 301;
yyy11 := 244;
DBMemo6.Width := xxx11;
DBMemo6.Height := yyy11;
Button13.Visible := true;
end;
procedure TForm3.FormShow(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
Form3.ChangLanguage8('RUSSIAN')
else
if DefaultLanguage = 'ENGLISH' then
Form3.ChangLanguage8('ENGLISH');
end;
procedure TForm3.Timer1Timer(Sender: TObject);
begin
if (DBEdit1.Text <> '') and (DBEdit2.Text <> '') and (DBEdit3.Text <> '') and
(DBEdit5.Text <> '') and (DBMemo1.Text <> '') and (DBMemo2.Text <> '') and
(DBMemo3.Text <> '') and (DBMemo4.Text <> '') and
(DBComboBox1.Text <> '') and (DBComboBox2.Text <> '') then
Button1.Enabled := true
else
Button1.Enabled := false;
end;
procedure TForm3.ChangLanguage8(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TLabel then // LABEL
(Components[i-1] as TLabel).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TLabel).Caption);
if Components[i-1].ClassType = TButton then // BUTTON
(Components[i-1] as TButton).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TButton).Caption);
end;
end;
LanguageIniFile.Free;
end;
end.

Листинг Form4


var
Form4: TForm4;
col :integer;
procedure TForm4.Button1Click(Sender: TObject);
begin
Form2.ADOTable1.Post;
Form2.ADOTable2.Edit;
Form3.DBEdit1.Text := Form4.DBEdit1.Text;
Form3.DBEdit2.Text := Form4.DBEdit2.Text;
Form3.DBEdit3.Text := Form4.DBEdit3.Text;
Form3.Visible := true;
Form3.Show;
Form3.Caption := '2-й этап добавления';
Form3.Button30.Visible := true;
Form3.Button31.Visible := true;
Form3.Panel1.BringToFront;
Form4.Close;
end;
procedure TForm4.Button2Click(Sender: TObject);
begin
Form2.ADOTable1.Delete;
Form4.Close;
end;
procedure TForm4.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form1.Enabled := true;
Form2.Enabled := true;
Form4.Button1.Enabled := false;
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
col := 0;
end;
procedure TForm4.FormShow(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
Form4.ChangLanguage7('RUSSIAN');
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form4.ChangLanguage7('ENGLISH');
end;
end;
procedure TForm4.ChangLanguage7(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TLabel then
(Components[i-1] as TLabel).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TLabel).Caption);
if Components[i-1].ClassType = TButton then
(Components[i-1] as TButton).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TButton).Caption);
end;
end;
LanguageIniFile.Free;
end;
procedure TForm4.DBEdit1Change(Sender: TObject);
begin
Button1.Enabled := (DBEdit1.Text <> '') and (DBEdit3.Text <> '') and (DBEdit3.Text <> '');
end;
procedure TForm4.DBEdit2Change(Sender: TObject);
begin
Button1.Enabled := (DBEdit1.Text <> '') and (DBEdit3.Text <> '') and (DBEdit3.Text <> '');
end;
procedure TForm4.DBEdit3Change(Sender: TObject);
begin
Button1.Enabled := (DBEdit1.Text <> '') and (DBEdit3.Text <> '') and (DBEdit3.Text <> '');
end;
end.

Листинг Form5


procedure TForm5.Button2Click(Sender: TObject);
begin
Edit1.Text := '';
Form5.RadioGroup1.ItemIndex := -1;
Form2.DBGrid1.DataSource.DataSet.Filtered := false;
end;
procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Edit1.Text := '';
Form2.DBGrid1.DataSource.DataSet.Filtered := false;
end;
procedure TForm5.FormShow(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
Form5.ChangLanguage6('RUSSIAN');
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form5.ChangLanguage6('ENGLISH');
end;
end;
procedure TForm5.RadioGroup1Click(Sender: TObject);
begin
Form2.ADOTable1.Filtered := false;
Form2.ADOTable1.Filtered := true;
end;
procedure TForm5.ChangLanguage6(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TRadioGroup then
(Components[i-1] as TRadioGroup).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TRadioGroup).Caption);
if Components[i-1].ClassType = TLabel then
(Components[i-1] as TLabel).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TLabel).Caption);
end;
end;
LanguageIniFile.Free;
end;
procedure TForm5.Edit1Change(Sender: TObject);
begin
if Edit1.Text <> '' then
Form2.ADOTable1.Filtered := false;
Form2.ADOTable1.Filtered := true;
end;
procedure TForm5.Edit1KeyPress(Sender: TObject; var Key: Char); // первая буква заглавная
var
s :string;
begin
s := Key;
if GetKeyState(VK_Shift) < 0 then
s := AnsiUpperCase(s)
else
begin
if Edit1.SelStart = 0 then
s := AnsiUpperCase(s)
else
s := AnsiLowerCase(s);
end;
Key := s[1];
end;
end.

Листинг Form6


procedure TForm6.ChangLanguage3(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
end;
LanguageIniFile.Free;
end;
procedure TForm6.FormShow(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
Form6.ChangLanguage3('RUSSIAN');
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form6.ChangLanguage3('ENGLISH');
end;
end;
end.

Листинг Form7


procedure TForm7.ChangLanguage4(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TButton then
(Components[i-1] as TButton).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TButton).Caption);
if Components[i-1].ClassType = TLabel then
(Components[i-1] as TLabel).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TLabel).Caption);
end;
end;
LanguageIniFile.Free;
end;
end.

Листинг Form8


procedure TForm8.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TForm8.FormShow(Sender: TObject);
begin
if DefaultLanguage = 'RUSSIAN' then
begin
Form8.ChangLanguage5('RUSSIAN');
end
else
if DefaultLanguage = 'ENGLISH' then
begin
Form8.ChangLanguage5('ENGLISH');
end;
end;
procedure TForm8.ChangLanguage5(Langselection: string);
var
ProgramPath :string;
i :integer;
begin
if ComponentCount <> 0 then
begin
ProgramPath := ExtractFileDir(Application.ExeName);
if ProgramPath[Length(ProgramPath)] <> '\' then
ProgramPath := ProgramPath + '\';
LanguageIniFile := TIniFile.Create(ProgramPath + 'language.ini');
Caption := LanguageIniFile.ReadString(Langselection, name, Caption);
DefaultLanguage := Langselection;
for i := 1 to ComponentCount do
begin
if Components[i-1].ClassType = TButton then
(Components[i-1] as TButton).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TButton).Caption);
if Components[i-1].ClassType = TLabel then
(Components[i-1] as TLabel).Caption := LanguageIniFile.ReadString(Langselection,
name + Components[i-1].Name, (Components[i-1] as TLabel).Caption);
end;
end;
LanguageIniFile.Free;
end;
end.

Достарыңызбен бөлісу:
1   ...   19   20   21   22   23   24   25   26   27




©engime.org 2024
әкімшілігінің қараңыз

    Басты бет