Текстовый редактор

Так выглядит программ. А ниже представлена главная форма программы в disign-time.

Форма

Раздел INTERFACE выглядит следующим образом:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ComCtrls;

type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
Hello1: TMenuItem;
exit1: TMenuItem;
N2: TMenuItem;
Exit4: TMenuItem;
Edit1: TMenuItem;
Help1: TMenuItem;
About1: TMenuItem;
N3: TMenuItem;
RichEdit1: TRichEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Paste1: TMenuItem;
Paste2: TMenuItem;
SelectAll1: TMenuItem;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
ColorDialog1: TColorDialog;
Button8: TButton;
FontDialog1: TFontDialog;
Button9: TButton;
procedure Exit4Click(Sender: TObject);
procedure About1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure Paste1Click(Sender: TObject);
procedure Paste2Click(Sender: TObject);
procedure SelectAll1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure RichEdit1Change(Sender: TObject);
procedure Hello1Click(Sender: TObject);
procedure exit1Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;



Код модуля представлен ниже

 

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Exit4Click(Sender: TObject);
begin
halt;
end;

procedure TForm1.About1Click(Sender: TObject);
begin
Form2.Show;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if RichEdit1.sellength>0 then
Form1.RichEdit1.CopyToClipboard;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if RichEdit1.sellength>0 then
Form1.RichEdit1.CutToClipboard;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Form1.RichEdit1.PasteFromClipboard;
end;

procedure TForm1.N3Click(Sender: TObject);
begin
if RichEdit1.sellength>0 then
Form1.RichEdit1.CopyToClipboard;
end;

procedure TForm1.Paste1Click(Sender: TObject);
begin
if RichEdit1.sellength>0 then
Form1.RichEdit1.CutToClipboard;
end;

procedure TForm1.Paste2Click(Sender: TObject);
begin
Form1.RichEdit1.pastefromClipboard;
end;

procedure TForm1.SelectAll1Click(Sender: TObject);
begin
Form1.RichEdit1.SelectAll;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
if RichEdit1.Sellength>0 then
RichEdit1.SelAttributes.Style:=[fsbold];
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
if RichEdit1.SelLength>0 then
RichEdit1.SelAttributes.Style:=[fsitalic];
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
if RichEdit1.SelLength>0 then
RichEdit1.SelAttributes.Style:=[fsunderline];
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
if Richedit1.SelLength>0 then
RichEdit1.SelAttributes.Style:=[];
end;

procedure TForm1.RichEdit1Change(Sender: TObject);
begin
RichEdit1.DefAttributes.Size:=12;
end;

procedure TForm1.Hello1Click(Sender: TObject);
begin
if OpenDialog1.Execute then RichEdit1.Lines.LoadFromFile(OpenDialog1.FileName);
end;

procedure TForm1.exit1Click(Sender: TObject);
begin
If SaveDialog1.Execute then Richedit1.Lines.SaveToFile(SaveDialog1.Filename);
end;

procedure TForm1.Button8Click(Sender: TObject);
begin
if ColorDialog1.Execute then
RichEdit1.SelAttributes.color:=ColorDialog1.color;
end;

procedure TForm1.Button9Click(Sender: TObject);
begin
if FontDialog1.Execute then
RichEdit1.Font:=FontDialog1.Font;
end;

end.

 

 

Сайт создан в системе uCoz