这个程序可以人吧!
unit UnRTF;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
ComboBox1: TComboBox;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
ColorDialog: TColorDialog;
Edit2: TEdit;
Button3: TButton;
Button4: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Items:=Screen.Fonts;
ComboBox1.Text:='宋体';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if ColorDialog.Execute then
begin
Edit2.Color:=ColorDialog.Color;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
n:Integer;
begin
n:=Length(Edit2.text);
RichEdit1.Lines.Add(Edit2.Text);
RichEdit1.SelLength:=-n-2;
RichEdit1.SelAttributes.Name:=ComboBox1.Text;
RichEdit1.SelAttributes.Color:=Edit2.Color;
RichEdit1.SelAttributes.Size:=StrToInt(Edit1.text);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
RichEdit1.SelAttributes.Name:=ComboBox1.Text;
RichEdit1.SelAttributes.Color:=Edit2.Color;
RichEdit1.SelAttributes.Size:=StrToInt(Edit1.text);
RichEdit1.Lines.Add(Edit2.Text);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
RichEdit1.Lines.Add(Edit2.Text);
end;
end.