请问各位大侠:我自动创建了一组控件组:
var
img:array[1..10] of Timage;
i:integer;
begin
for i:=1 to 10 do
begin
img[i]:=timage.create(self);
end;
end;
如何定义img[i]的事件,谢谢!
var
img:array[1..10] of Timage;
i:integer;
begin
for i:=1 to 10 do
begin
img[i]:=timage.create(self);
end;
end;
如何定义img[i]的事件,谢谢!
解决方案 »
- 药品电子监管码上传问题
- 求助:在一个TImage控件里画四条曲线
- 请问为什么delphi7龙卷风企业版安装后 新建中没有 ActiveX等很多项目呢?
- 4个表关联,用这个SQL语句正确吗?有没有更科学高效的方法?
- 【用adoquery虚拟字段实现数据列的checkboxes操作?】
- 怎樣使用delphi的調試器
- 感谢帮助过我的各位大哥~散分(今天揭贴)
- 只一个按钮,把ACCESS内A,B,C三个表数据导进SQL SERVE内A,B,C三个表中,多谢!
- 过年了,我也来庆祝一下,散分
- 挺变态的一道面试题,请教高手.
- VB6调用Delphi编写的ActiveX DLL中接口参数为PChar的问题
- 散分!先祝大家新的一年快乐!
beginend;var
img:array[1..10] of Timage;
i:integer;
begin
for i:=1 to 10 do
begin
img[i]:=timage.create(self);
img[i].OnClick:=ImageClick;
end;
end;
procedure TForm1.ImgClick(Sender: TObject);
begin
...
case TImage(Sender).tag of
1:....
2:....
3:....
....
end; //end of case
...
end;在interface的private或public中声明之for i:=1 to 10 do
begin
img[i]:=timage.create(self);
img[i].tag:=i;
img[i].OnClick:=ImgClick;
end;将每个img的tag属性编上不同的号,根据tag属性就可以知道触发该事件的是哪一个,
然后根据需要使用case ... of 分别处理
//定义此过程时,参数必须与要引用此过程的控件的事件参数一致
beginend;var
img:array[1..10] of Timage;
i:integer;
begin
for i:=1 to 10 do
begin
img[i]:=timage.create(self);
img[i].OnClick:=ImageClick;
end;
end;