unit U_CreateShop;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,ExtCtrls,StdCtrls,Math,U_public,ComCtrls,Buttons;type TCB=class public constructor create_shop(namestr,enamestr,picstr,actionstr,pricestr,typestr:string;N_ScrollBox:TScrollBox); procedure MyClick(Sender: TObject);end;constructor TCB.create_shop(namestr,enamestr,picstr,actionstr,pricestr,typestr:string;N_ScrollBox:TScrollBox);var ima:Timage; bt:Timage; lbname:TLabel; lbaction:TLabel; lbprice:TLabel;begin if imacount=0 then //创建第一列的全部控件 begin //创建物品图片 ima := TImage.Create(N_ScrollBox); ima.Parent := N_ScrollBox; ima.left := 20; ima.Top:=imatop+ 8; ima.Width:= 66; ima.Height:= 66; ima.Picture.LoadFromFile(picstr); ima.onclick:=MyClick; //重点在这里~! end;procedure TCB.MyClick(Sender: TObject);begin showmessage(TImage(sender).name);end;有些细微改下