zoukankan      html  css  js  c++  java
  • Windows的自带控件(比如TButton)大多数消息都由它自己处理,Delphi覆盖了那么多WM_函数优先级较低,一般用不上

    在空窗体上放一个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停在这里。

  • 相关阅读:
    centos 修改语言、时区
    去除 ufeff
    Docker介绍及使用
    消息队列
    数据结构与算法
    Haystack
    Python面向对象之魔术方法
    关于Redis处理高并发
    Redis
    RESTful规范
  • 原文地址:https://www.cnblogs.com/findumars/p/5361958.html
Copyright © 2011-2022 走看看