if image1.picture.icon='' then
  begin
    .....
  end;1.出错!!
   image1.picture.icon='' ???怎么判断image1里没有图像??2. 屏蔽书标右键
if button=mbright then
 begin
  if image1.picture.icon='' then
    begin
      屏蔽书标右键
    end;
  end;

解决方案 »

  1.   

    这样行么
    if not assign(image1.picture.icon) then
      

  2.   

    if button=mbright then exit;不就屏蔽了么
      

  3.   

    不行啊!1
    if not assign(image1.picture.icon) then
      begin
      end;
    你给的代码出错??
      

  4.   

    我要求先判断image1.picture是否为空??
    判断里没有图像??
      

  5.   

    用以下语句可以判断image中是否有picture存在。
    if image1.Picture.Bitmap.Empty then
    image1.Picture.LoadFromFile('D:\Program Files\Borland\Borland Shared\Images\Icons\chip16.bmp');
      

  6.   

    to:
       tjff2000(fengyun) 可以了。
    但是还差一点怎么屏蔽书标右键
      

  7.   

    if isnull(image1.picture.icon) then
      

  8.   

    (1)将PopupMenu的AutoPopup设为False;
    (2)然后在窗口的OnMouseDown事件中写入如下语句:
    procedure TMainForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    var
      ScrnPt: TPoint;
    begin
      if not ( (Button = mbRight) and 
           (PtInRect(Image1.BoundsRect, Point(X, Y))) ) then
      begin  // 需要同时满足是鼠标右键按下,并且按下的区域不在Image1所在的矩形区域内。
        ScrnPt := ClientToScreen(Point(X, Y));
        PopupMenu1.Popup(ScrnPt.X, ScrnPt.Y);
      end;
    end;
      

  9.   

    以下两句都可以判断是否有图片:
    if not Assigned(Image1.Picture.Icon) then ...
    if Image1.Picture.Icon <> nil then ...
      

  10.   

    TommyTong(童童--试图崛起……) 
    如果image里面有图的话,单击图就不见了??
      

  11.   

    To mmyTong(童童--试图崛起……) 
    你以上的判断是否有图片的两种方法都不正确,可以用
    if image1.Picture.Bitmap.Empty then
    or if image1.Picture.Icon.Empty then都行。
    to cjdbd()
    你看看下面的代码可否
    if (image1.Picture.bitmap.Empty) and (button=mbright) then
    popupmenu1.AutoPopup:=false;