Смекни!
smekni.com

Разработка текстового редактора 2 (стр. 2 из 2)

end;

procedure TForm1.SpeedButton5Click(Sender: TObject);

begin

N6Click(Sender);

end;

procedure TForm1.N11Click(Sender: TObject);

begin

If Form1.ColorDialog1.Execute then

Form1.Memo1.Color:=Form1.ColorDialog1.Color;

end;

procedure TForm1.N10Click(Sender: TObject);

begin

If Form1.ColorDialog1.Execute then

Form1.Memo1.Font.Color:=Form1.ColorDialog1.Color;

end;

procedure TForm1.FormResize(Sender: TObject);

begin

Memo1.Height:=Form1.Height-110;

Memo1.Width:=Form1.Width;

end;

procedure TForm1.ToolButton1Click(Sender: TObject);

begin

N2Click(Sender);

end;

procedure TForm1.ToolButton2Click(Sender: TObject);

begin

N3Click(Sender);

end;

procedure TForm1.ToolButton3Click(Sender: TObject);

begin

N4Click(Sender);

end;

procedure TForm1.ToolButton4Click(Sender: TObject);

begin

N5Click(Sender);

end;

procedure TForm1.ToolButton5Click(Sender: TObject);

begin

N6Click(Sender);

end;

procedure TForm1.N21Click(Sender: TObject);

begin

Memo1.CutToClipboard;

end;

procedure TForm1.N22Click(Sender: TObject);

begin

Memo1.CopyToClipboard;

end;

procedure TForm1.N23Click(Sender: TObject);

begin

Memo1.PasteFromClipboard;

end;

procedure TForm1.N24Click(Sender: TObject);

begin

Memo1.ClearSelection;

end;

procedure TForm1.ToolButton6Click(Sender: TObject);

begin

N20Click(Sender);

end;

procedure TForm1.ToolButton7Click(Sender: TObject);

begin

N21Click(Sender);

end;

procedure TForm1.ToolButton8Click(Sender: TObject);

begin

N22Click(Sender);

end;

procedure TForm1.ToolButton9Click(Sender: TObject);

begin

N23Click(Sender);

end;

procedure TForm1.ToolButton10Click(Sender: TObject);

begin

N24Click(Sender);

end;

procedure TForm1.N20Click(Sender: TObject);

begin

Memo1.SelectAll

end;

procedure TForm1.ToolButton12Click(Sender: TObject);

begin

Form1.Memo1.Alignment:=taleftJustify

end;

procedure TForm1.ToolButton13Click(Sender: TObject);

begin

Form1.Memo1.Alignment:=taCenter;

end;

procedure TForm1.ToolButton14Click(Sender: TObject);

begin

Form1.Memo1.Alignment:=taRightJustify;

end;

procedure TForm1.ToolButton16Click(Sender: TObject);

begin

N10Click(Sender);

end;

procedure TForm1.ToolButton17Click(Sender: TObject);

begin

N11Click(Sender);

end;

procedure TForm1.ToolButton11Click(Sender: TObject);

begin

with Memo1 do

if HandleAllocated then SendMessage(Handle, EM_UNDO, 0, 0);

end;

procedure TForm1.N13Click(Sender: TObject);

begin

Form1.N13.Tag:=Form1.N13.Tag+1;

if (Form1.N13.Tag mod 2)<>0 then

panel1.Visible:=false

else panel1.Visible:=true;

end;

procedure TForm1.N14Click(Sender: TObject);

begin

form3.Show;

end;

procedure TForm1.N26Click(Sender: TObject);

begin

Form2.show;

end;

procedure TForm1.N27Click(Sender: TObject);

begin

Form3.show;

end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);

var a:integer;

begin

if Form1.Memo1.Modified=true then

begin

a:=Application.MessageBox('Сохранить изменения в документе','',3);

if a=6 then

N4Click(Sender)

else if a=7 then

halt

else canclose:=false;

end

end;

end.

unit Unit2;

interface

uses

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

Dialogs, StdCtrls, Mask;

type

TForm2 = class(TForm)

MaskEdit1: TMaskEdit;

Label1: TLabel;

Button1: TButton;

Button2: TButton;

MaskEdit2: TMaskEdit;

Label2: TLabel;

Button3: TButton;

Button4: TButton;

MaskEdit3: TMaskEdit;

Label3: TLabel;

Button5: TButton;

Button6: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);

begin

Form1.Memo1.Seltext:=MaskEdit1.text;

end;

procedure TForm2.Button2Click(Sender: TObject);

begin

Form1.Memo1.Lines.Add(Maskedit1.Text);

end;

procedure TForm2.Button3Click(Sender: TObject);

begin

Form1.Memo1.Seltext:=MaskEdit2.text;

end;

procedure TForm2.Button5Click(Sender: TObject);

begin

Form1.Memo1.Seltext:=MaskEdit3.text;

end;

procedure TForm2.Button4Click(Sender: TObject);

begin

Form1.Memo1.Lines.Add(Maskedit2.Text);

end;

procedure TForm2.Button6Click(Sender: TObject);

begin

Form1.Memo1.Lines.Add(Maskedit3.Text);

end;

end.

unit Unit3;

interface

uses

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

Dialogs, StdCtrls, ComCtrls, ExtCtrls;

type

TForm3 = class(TForm)

Label1: TLabel;

Label2: TLabel;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

uses Unit1, Unit2;

{$R *.dfm}

end.