设置image控件的点击事件
procedure TForm1.img1Click(Sender: TObject);
begin
Application.MessageBox('我被点击了啊','提示');
end;
设置button按钮的点击事件,并将点击传给image控件
procedure TForm1.btn1Click(Sender: TObject);
beginSelf.img1Click(btn1);
end;
点击button按钮时就会弹出对话框‘我被点击了啦’
实现点击button按钮触发image的点击事件