//以下是VCL的源程序,请看注释部分问题。
procedure TWinControl.WMPaint(var Message: TWMPaint);
var
  DC, MemDC: HDC;
  MemBitmap, OldBitmap: HBITMAP;
  PS: TPaintStruct;
begin
  if not FDoubleBuffered or (Message.DC <> 0) then
  begin
    if not (csCustomPaint in ControlState) and (ControlCount = 0) then
      inherited //这里分明是调用基类的WMPaint方法,可我在其继承类中没有找到该方法,请问怎么回事?
    else
      PaintHandler(Message);
  end

解决方案 »

  1.   

    您帮找下:
    TWinControl->TControl->TCompnent->TPersistent->TObject
    看在哪里。
      

  2.   

    怎么会没有呢,很好找出来啊
    procedure TWinControl.WMPaint(var Message: TWMPaint);
    var
      DC, MemDC: HDC;
      MemBitmap, OldBitmap: HBITMAP;
      PS: TPaintStruct;
    begin
      if not FDoubleBuffered or (Message.DC <> 0) then
      begin
        if not (csCustomPaint in ControlState) and (ControlCount = 0) then
          inherited
        else
          PaintHandler(Message);
      end
      else
      begin
        DC := GetDC(0);
        MemBitmap := CreateCompatibleBitmap(DC, ClientRect.Right, ClientRect.Bottom);
        ReleaseDC(0, DC);
        MemDC := CreateCompatibleDC(0);
        OldBitmap := SelectObject(MemDC, MemBitmap);
        try
          DC := BeginPaint(Handle, PS);
          Perform(WM_ERASEBKGND, MemDC, MemDC);
          Message.DC := MemDC;
          WMPaint(Message);
          Message.DC := 0;
          BitBlt(DC, 0, 0, ClientRect.Right, ClientRect.Bottom, MemDC, 0, 0, SRCCOPY);
          EndPaint(Handle, PS);
        finally
          SelectObject(MemDC, OldBitmap);
          DeleteDC(MemDC);
          DeleteObject(MemBitmap);
        end;
      end;
    end;
      

  3.   

    你没看清楚我的问题,我是说CWinControl调用的基类的WMPaint方法呀,你给我CWinControl的我也有帖出来呀。
      

  4.   

    TControl也有wndproc
    这里的wndproc继承的是TControl的wndproc
      

  5.   

    inherited 是什么意思呀,难道在WMPaint过程中使用inherited是调用基类的WndProc
      

  6.   

    见过个一个帖子,说过这个问题。
    http://topic.csdn.net/t/20030807/22/2121889.html
    楼主可以看一看