Sender是指出了收到事件的组件...
--------------------------------------------------
In an event handler, the Sender parameter indicates which component received the event and therefore called the handler. Sometimes it is useful to have several components share an event handler that behaves differently depending on which component calls it. You can do this by using the Sender parameter in an if...then...else statement. For example, the following code displays the title of the application in the caption of a dialog box only if the OnClick event was received by Button1.procedure TMainForm.Button1Click(Sender: TObject);begin
if Sender = Button1 then
AboutBox.Caption := 'About ' + Application.Title
else
AboutBox.Caption := '';
AboutBox.ShowModal;
end;
--------------------------------------------------
In an event handler, the Sender parameter indicates which component received the event and therefore called the handler. Sometimes it is useful to have several components share an event handler that behaves differently depending on which component calls it. You can do this by using the Sender parameter in an if...then...else statement. For example, the following code displays the title of the application in the caption of a dialog box only if the OnClick event was received by Button1.procedure TMainForm.Button1Click(Sender: TObject);begin
if Sender = Button1 then
AboutBox.Caption := 'About ' + Application.Title
else
AboutBox.Caption := '';
AboutBox.ShowModal;
end;
sender就是button1,因为这是button1click事件,明白了吗?
我想就是Sender参数把处理Windows消息简化了