如何判断Image控件中存在图像 ( 积分: 10 )

  • 主题发起人 主题发起人 555a
  • 开始时间 开始时间
5

555a

Unregistered / Unconfirmed
GUEST, unregistred user!
如何判断Image控件中存在图像,如果存在又如何清空它??
 
如何判断Image控件中存在图像,如果存在又如何清空它??
 
if Assigned(Image1.Picture.Graphic) then
Caption:='有图像'
else
Caption:='没有图像';

清空:Image1.Picture := nil;
Image1.Picture.Graphic := nil;
 
如对bitmap的图象清空 就用bitmap.assign(nil) 其他的也是一样
 
图象有一个empty的属性,你可以判断此属性是否为true
 
我是看图像的大小。
如果长或者宽为0就认为没图像。
 
if Image1.Picture <> nil then Image1.Picture = nil
 
多人接受答案了。
 
后退
顶部