您的位置:首页 > 其它

TControl.WMLButtonUp的inherited的作用——是为了给子类控件新的处理消息的机会

2015-08-25 20:41 507 查看
意外注意到这个小细节:

procedure TControl.WMLButtonUp(var Message: TWMLButtonUp);
begin
inherited; // 注意,如果是直接点击Form1,会执行TCustomForm.DefaultHandler(var Message);相当于给子类控件提供了新的处理消息的机会
if csCaptureMouse in ControlStyle then MouseCapture := False;
if csClicked in ControlState then
begin
Exclude(FControlState, csClicked);
if PtInRect(ClientRect, SmallPointToPoint(Message.Pos)) then
Click;
end;
DoMouseUp(Message, mbLeft);
end;


够阴险的啊,为什么要这样做呢?是为了提前把子类的一切充分融入到VCL官方框架中?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: