标签:
在空窗体上放一个TButton,一个TPanel,然后把在TWinControl.WMEraseBkgnd里下断点:
procedure TWinControl.WMEraseBkgnd(var Message: TWMEraseBkgnd); begin with ThemeServices do // 这里下断点 if ThemesEnabled and Assigned(Parent) and (csParentBackground in FControlStyle) then begin { Get the parent to draw its background into the control‘s background. } DrawParentBackground(Handle, Message.DC, nil, False); end else begin { Only erase background if we‘re not doublebuffering or painting to memory. } if not FDoubleBuffered or (TMessage(Message).wParam = TMessage(Message).lParam) then FillRect(Message.DC, ClientRect, FBrush.Handle); end; Message.Result := 1; end;
点击运行,发现程序两次停留在断点上,在观察窗口输入Self.Name,发现就是Form1和Panel1,而没有Button1停在这里。
Windows的自带控件(比如TButton)大多数消息都由它自己处理,Delphi覆盖了那么多WM_函数优先级较低,一般用不上
标签:
原文地址:http://www.cnblogs.com/findumars/p/5361958.html