![]() |
|
|
Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
|
Опции темы | Поиск в этой теме | Опции просмотра |
#16
|
||||
|
||||
![]() Ну вот вам вариант:
Код:
program Project30; uses Forms, Unit30 in 'Unit30.pas' {frmSave}, Unit31 in 'Unit31.pas' {frmLoad}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TfrmSave, frmSave); Application.CreateForm(TfrmLoad, frmLoad); Application.Run; end. Код:
unit Unit30; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TfrmSave = class(TForm) Edit1: TEdit; Edit2: TEdit; Label2: TLabel; Label3: TLabel; Button2: TButton; SaveDialog1: TSaveDialog; Label1: TLabel; Button1: TButton; Edit3: TEdit; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frmSave: TfrmSave; implementation uses Unit31; {$R *.dfm} procedure TfrmSave.Button1Click(Sender: TObject); Var SJFile: TextFile; begin if not SaveDialog1.Execute then Exit; Edit3.Text := SaveDialog1.FileName; AssignFile(SJFile, SaveDialog1.FileName); Rewrite(SJFile); WriteLn(SJFile, Edit1.Text); WriteLn(SJFile, Edit2.Text); CloseFile(SJFile); end; procedure TfrmSave.Button2Click(Sender: TObject); begin frmSave.Hide; frmLoad.Show; end; end. Код:
object frmSave: TfrmSave Left = 754 Top = 525 Caption = #1057#1086#1093#1088#1072#1085#1103#1083#1082#1072 ClientHeight = 122 ClientWidth = 473 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poDesigned PixelsPerInch = 96 TextHeight = 13 object Label2: TLabel Left = 17 Top = 11 Width = 29 Height = 13 Caption = #1057#1090#1088'1:' end object Label3: TLabel Left = 17 Top = 37 Width = 29 Height = 13 Caption = #1057#1090#1088'2:' end object Label1: TLabel Left = 16 Top = 64 Width = 30 Height = 13 Caption = #1060#1072#1081#1083':' end object Edit1: TEdit Left = 52 Top = 8 Width = 405 Height = 21 TabOrder = 0 end object Edit2: TEdit Left = 52 Top = 34 Width = 405 Height = 21 TabOrder = 1 end object Button2: TButton Left = 344 Top = 91 Width = 113 Height = 25 Caption = #1050' '#1047#1072#1075#1088#1091#1078#1072#1083#1082#1077' >>' TabOrder = 2 OnClick = Button2Click end object Button1: TButton Left = 437 Top = 61 Width = 20 Height = 21 Caption = '...' TabOrder = 3 OnClick = Button1Click end object Edit3: TEdit Left = 53 Top = 61 Width = 383 Height = 21 TabOrder = 4 end object SaveDialog1: TSaveDialog DefaultExt = '*.sj' Filter = 'StipJey-'#1092#1072#1081#1083' (*.sj)|*.sj|'#1042#1089#1077' '#1092#1072#1081#1083#1099' (*.*)|*.*' Options = [ofOverwritePrompt, ofHideReadOnly, ofEnableSizing] Left = 400 Top = 56 end end Код:
unit Unit31; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TfrmLoad = class(TForm) Button2: TButton; Label3: TLabel; Label2: TLabel; Label1: TLabel; Edit2: TEdit; Button1: TButton; Edit1: TEdit; Edit3: TEdit; OpenDialog1: TOpenDialog; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } end; var frmLoad: TfrmLoad; implementation uses Unit30; {$R *.dfm} procedure TfrmLoad.Button1Click(Sender: TObject); Var SJFile: TextFile; S: String; begin if not OpenDialog1.Execute then Exit; Edit3.Text := OpenDialog1.FileName; AssignFile(SJFile, OpenDialog1.FileName); Reset(SJFile); ReadLn(SJFile, S); Edit1.Text := S; ReadLn(SJFile, S); Edit2.Text := S; CloseFile(SJFile); end; procedure TfrmLoad.Button2Click(Sender: TObject); begin frmLoad.Hide; frmSave.Show; end; procedure TfrmLoad.FormClose(Sender: TObject; var Action: TCloseAction); begin frmSave.Close; end; end. Код:
object frmLoad: TfrmLoad Left = 754 Top = 525 Caption = #1047#1072#1075#1088#1091#1078#1072#1083#1082#1072 ClientHeight = 121 ClientWidth = 464 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poDesigned OnClose = FormClose PixelsPerInch = 96 TextHeight = 13 object Label3: TLabel Left = 17 Top = 67 Width = 29 Height = 13 Caption = #1057#1090#1088'2:' end object Label2: TLabel Left = 17 Top = 43 Width = 29 Height = 13 Caption = #1057#1090#1088'1:' end object Label1: TLabel Left = 16 Top = 16 Width = 30 Height = 13 Caption = #1060#1072#1081#1083':' end object Button2: TButton Left = 17 Top = 91 Width = 112 Height = 25 Caption = '<< '#1050' '#1057#1086#1093#1088#1072#1085#1103#1083#1082#1077 TabOrder = 0 OnClick = Button2Click end object Edit2: TEdit Left = 52 Top = 64 Width = 405 Height = 21 TabOrder = 1 end object Button1: TButton Left = 437 Top = 13 Width = 20 Height = 21 Caption = '...' TabOrder = 2 OnClick = Button1Click end object Edit1: TEdit Left = 52 Top = 40 Width = 405 Height = 21 TabOrder = 3 end object Edit3: TEdit Left = 53 Top = 13 Width = 383 Height = 21 TabOrder = 4 end object OpenDialog1: TOpenDialog DefaultExt = '*.sj' Filter = 'StipJey-'#1092#1072#1081#1083' (*.sj)|*.sj|'#1042#1089#1077' '#1092#1072#1081#1083#1099' (*.*)|*.*' Left = 400 Top = 8 end end Жизнь такова какова она есть и больше никакова. Помогаю за спасибо. |