我把我的源程序贴出来:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
var
image:timage;
bitmap:tbitmap;
begin
bitmap:=tbitmap.Create;
bitmap.LoadFromFile('e:/the 8/image/back.bmp');
image:=timage.Create(self);
image.Parent:=form1;
image.Width:=250;
image.Height:=180;
image.Stretch:=true;
image.Canvas.Draw(0,0,bitmap);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
.........................
end;
end.
如何在FormClose中实现image的清空。image1.picture.graphic := nil;是不行的。