我想做的是,点击一幅小的图片,后让她显示在另一个panel上。但当我者小幅图片是自动生成的image时,就去不到当前的i值.
    procedure TForm1.BitBtn1Click(Sender: TObject);
var
  i:integer;
begin
  i:=1;
  currentselectednum:=1;
  while i<=maxshowbmpnum do
  begin
   if showbararray[i].showimage=(sender as Timage) then
   begin
    currentselectednum:=i;
    i:=i+maxshowbmpnum;
   end else
   i:=i+1;
  end;
  bigview(currentselectednum);
end;
 后再用image2.onclick:=bitbtn1.onclick,赋给image2.当为image2时,i=1 ,
 但i值老取不到,是不是sender as timage 这句话不能用。
  

解决方案 »

  1.   

    上面的这个问题已解决。
      问各位一个新的问题。
      我在listview中动态生成的panel,怎样清空?
      

  2.   

    什么意思?
    panel.caption:=""
      

  3.   

    InvalidateRect(panel1.Handle,nil,false);
      

  4.   

    if showbararray[i].showimage=(sender as Timage) then改为
     if showbararray[i].showimage is Timage then
      

  5.   

    错了,应该是:
     if Sender as TImage then 
      if TImage(Sender)=Showbararray[i].showimage then