Image.Picture.Bitmap.Free;或 Image->Picture->Graphic := nil;
这样合理吗.
这样合理吗.
解决方案 »
- 关于内存分配失败的问题
- 特急呀! 为什么调用DLL会出现“灾难性故障”,就是ClientDataSet.data=NewData出错。
- QQ2006如何自动打开好友聊天窗口????
- 主窗口关闭时,在停止查询数据的线程时报错!
- 有关在dbgrid里面添加数据的问题??
- 由x mod y=z如何根据z,y计算出x呢?100分!!!
- 救命啊,100分!
- 如何在dbgrid中增加多选功能(用shift实现,点ctrl实现的功能我已经有了)
- 救命呀!!!!!!
- 可以用SENDMESSAGE模拟MOUSE和KEYBOARD输入吗?
- 求助:如何打印 "select * from db where id<1000" 查询出来的表格啊!!
- 使用CXGRID中有点新的问题,只有一列的CXGRID中新增一行内容时要回车后才能取得这行的内容,还有如新增一行不输入,什么也不操作去取得这
---------------------------------
...哇哈哈哈 CSDN's forum Explorer
虽然已经NILl了..可是下面怎么测都是not nil ???
if image1.Picture=nil then
showmessage('image1 picture is nil')
else showmessage('image1 picture is not nil');
这也可以??玩笑开大了吧??
procedure TImage.SetPicture(Value: TPicture);
begin
FPicture.Assign(Value);
end;
procedure TPicture.Assign(Source: TPersistent);
begin
if Source = nil then
SetGraphic(nil)
else if Source is TPicture then
SetGraphic(TPicture(Source).Graphic)
else if Source is TGraphic then
SetGraphic(TGraphic(Source))
else
inherited Assign(Source);
end;procedure TPicture.SetGraphic(Value: TGraphic);
var
NewGraphic: TGraphic;
begin
NewGraphic := nil;
if Value <> nil then
begin
NewGraphic := TGraphicClass(Value.ClassType).Create;
NewGraphic.Assign(Value);
NewGraphic.OnChange := Changed;
NewGraphic.OnProgress := Progress;
end;
try
FGraphic.Free; //<------ 此处释放了原来的图像
FGraphic := NewGraphic; //<--------- 使用新图像
Changed(Self);
except
NewGraphic.Free;
raise;
end;
end;