delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
timage组件判断是否有图片小问题,高手进,在线等..... VCL组件开发及应用
http://www.delphi2007.net/DelphiVCL/html/delphi_20061220165852240.html
如题:  
      怎样判断image1里是否有片呀??  
      if   image1.picture.graphic=nil   then  
  还是  
      if   image1.picture.graphic.empty   then  
   
  这两个好像有冲突,因为我要在一个按钮里先清空图片  
   
  清空图片按钮事件:  
  procedure   TFrm_ckxs.Myspeedbutton3Click(Sender:   TObject);  
  begin  
      Image_zp.Picture.Graphic:=nil;  
  end;  
   
  然后在另一个按钮事件里判断image1是否有图片,判断事件如下:  
  无论是if   image1.picture.graphic=nil   then  
  还是  
  if   image1.picture.graphic.empty   then  
  好像都不对呀??请高手指点,在线等之  
 

有没有人呀

procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
   
      images.Picture.Graphic   :=   nil  
  end;  
   
  procedure   TForm1.Button2Click(Sender:   TObject);  
  begin  
      if   images.Picture.Graphic<>   nil   then  
          showmessage('接分');  
  end;  
   
  delphi7   下测试通过。

不对  
 

procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
  if   image1.Picture.Graphic=nil   then  
    showmessage('mei   tu')  
    else  
    showmessage('you   tu   ');  
  end;  
   
  procedure   TForm1.Button2Click(Sender:   TObject);  
  begin  
  image1.Picture.Assign(nil);  
  end;

procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
  if   image1.Picture.Graphic=nil   then  
    showmessage('mei   tu')  
    else  
    showmessage('you   tu   ');  
  end;  
   
  procedure   TForm1.Button2Click(Sender:   TObject);  
  begin  
  image1.Picture.Graphic:=nil;  
  //image1.Picture.Assign(nil);  
   
  end;  
   
  而且这么做也是可以的,不知道你为什么不行

if   image1.picture.graphic=nil   then  
    OK!!

结了

谢谢大家

posted on 2009-01-04 16:51 delphi2007 阅读(154) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。