主题:为了让字体对话框能响应OnApply事件!!!
谁告诉我一下,我的以下代码不能响应OnApply,谁帮我看看,问题在哪?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
FontDialog1: TFontDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
Procedure FontDlgApply(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
fontdialog1.Font :=memo1.Font ;
fontdialog1.options:=[fdeffects,fdapplybutton] ;
if fontdialog1.Execute then
memo1.Font.Assign(fontdialog1.Font);
end;
Procedure TForm1.FontDlgApply(Sender:Tobject);
begin
memo1.Font.Assign(fontdialog1.Font);
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
FontDialog1: TFontDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
Procedure FontDlgApply(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
fontdialog1.Font :=memo1.Font ;
fontdialog1.options:=[fdeffects,fdapplybutton] ;
if fontdialog1.Execute then
memo1.Font.Assign(fontdialog1.Font);
end;
Procedure TForm1.FontDlgApply(Sender:Tobject);
begin
memo1.Font.Assign(fontdialog1.Font);
end;
end.