G
gst
Unregistered / Unconfirmed
GUEST, unregistred user!
我的目的是,在dll中建立一个FORM,包含Timer,image。用Bitmap控件调用一个图片,
time的interval为10,每次Timer1Timer中step减一,在image 中在(10,step)位置
显示这个图,用户按BUTTON后关闭FORM。运行后点击BUTTON后系统提示错误。
去掉Timer后,利用Bitmap控件调用一个图片,也不行。
如果在image的属性中选则图片则可以。
错误的形式为不断出现FORM,应该只出现一个。
请问为什么。dll中的这个单元如下:
unit DllFormUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls;
type
TDllForm = class(TForm)
Bevel1: TBevel;
Image1: TImage;
Bevel2: TBevel;
Button1: TButton;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
step:integer;
public
{ Public declarations }
end;
var
DllForm: TDllForm;
implementation
{$R *.DFM}
procedure TDllForm.Timer1Timer(Sender: TObject);
begin
step:=step-1;
DllForm.Paint;
end;
procedure TDllForm.FormShow(Sender: TObject);
var Bitmap:TBitMap;
begin
Bitmap:=TBitmap.Create;
Bitmap.LoadFromFile('about.bmp');
DllForm.Image1.Canvas.Brush.Color:=clBlack;
DllForm.Image1.Canvas.Rectangle(DllForm.Image1.ClientRect);
DllForm.Image1.Canvas.Draw(10,step,BitMap);
end;
end.
time的interval为10,每次Timer1Timer中step减一,在image 中在(10,step)位置
显示这个图,用户按BUTTON后关闭FORM。运行后点击BUTTON后系统提示错误。
去掉Timer后,利用Bitmap控件调用一个图片,也不行。
如果在image的属性中选则图片则可以。
错误的形式为不断出现FORM,应该只出现一个。
请问为什么。dll中的这个单元如下:
unit DllFormUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls;
type
TDllForm = class(TForm)
Bevel1: TBevel;
Image1: TImage;
Bevel2: TBevel;
Button1: TButton;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
step:integer;
public
{ Public declarations }
end;
var
DllForm: TDllForm;
implementation
{$R *.DFM}
procedure TDllForm.Timer1Timer(Sender: TObject);
begin
step:=step-1;
DllForm.Paint;
end;
procedure TDllForm.FormShow(Sender: TObject);
var Bitmap:TBitMap;
begin
Bitmap:=TBitmap.Create;
Bitmap.LoadFromFile('about.bmp');
DllForm.Image1.Canvas.Brush.Color:=clBlack;
DllForm.Image1.Canvas.Rectangle(DllForm.Image1.ClientRect);
DllForm.Image1.Canvas.Draw(10,step,BitMap);
end;
end.