procedure TForm1.Button3Click(Sender: TObject); //57
begin
if ColorDialog1.Execute then
memo1.Font.Color:=ColorDialog1.Color;end;[Error] Unit1.pas(57): Statement expected but 'PROCEDURE' found什么意思呀,不懂呀,一共用了4个dialog,save,open,font和color,每个BUTTON都出类似的问题!
begin
if ColorDialog1.Execute then
memo1.Font.Color:=ColorDialog1.Color;end;[Error] Unit1.pas(57): Statement expected but 'PROCEDURE' found什么意思呀,不懂呀,一共用了4个dialog,save,open,font和color,每个BUTTON都出类似的问题!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
ColorDialog1: TColorDialog;
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
Button3: TButton;
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button3Click(Sender: TObject);
begin
if ColorDialog1.Execute then
memo1.Font.Color:=ColorDialog1.Color;
end;end.上面的是测试内容,并没有出现你所说的错误。你给出的只是一个片断,把整个单元放出来,问题出在其他地方。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Memo1: TMemo;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
FontDialog1: TFontDialog;
ColorDialog1: TColorDialog;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
procedure Button5Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button2Click(Sender: TObject); private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button5Click(Sender: TObject);
begin
close;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
try
if OpenDialog1.Execute then
begin
memo1.Lines.Clear ;
memo1.Lines.LoadFromFile(OpenDialog1.FileName );
end;
except On E:EreadError do
showmessage('此文件打开失败!');
end;procedure TForm1.Button3Click(Sender: TObject);
begin
if ColorDialog1.Execute then
memo1.Font.Color:=ColorDialog1.Color;end;procedure TForm1.Button4Click(Sender: TObject);
begin
try
if SaveDialog1.Execute then
memo1.Lines.SaveToFile(SaveDialog1.FileName);
except ON E:EreadError do
showmessage('此文件打开失败!');
end;
end;procedure TForm1.Button2Click(Sender: TObject);
begin
if FontDialog1.Execute then
memo1.Font:=FontDialog1.Font;
end;end.
这是全部内容了!!
begin
try
if OpenDialog1.Execute then
begin
memo1.Lines.Clear ;
memo1.Lines.LoadFromFile(OpenDialog1.FileName );
end;
except On E:EreadError do
showmessage('此文件打开失败!');
end;//注意哦!
end;
try
....
finally
....
end;
try
if OpenDialog1.Execute then
begin
Memo1.Lines.Clear ;
Memo1.Lines.LoadFromFile(OpenDialog1.FileName );
end;
except
On EreadError.Create('此文件打开失败!');
end;