Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1248450
  • 博文数量: 788
  • 博客积分: 4000
  • 博客等级: 上校
  • 技术积分: 7005
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-19 15:52
文章存档

2017年(81)

2011年(1)

2009年(369)

2008年(337)

分类:

2009-01-04 16:55:46

timage组件判断是否有图片小问题,高手进,在线等..... VCL组件开发及应用

如题:  
      怎样判断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!!

结了

谢谢大家



--------------------------
盛大招聘.Net开发工程师

新闻:2008年开源软件10大胜利
导航:博客园首页  知识库  新闻  招聘  社区  小组  博问  网摘  找找看
阅读(1154) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~