sendmessage WM_PAINT带背景的窗体_sendmessage

//WM_PAINT带背景的窗体  
  private
      { Private declarations }
    Bitmap:TBitmap;
    procedure WMPaint(var msg:TWMPAINT);Message WM_PAINT;


procedure TForm1.WMPaint(var msg:TWMPAINT);
begin
  inherited;
  StretchBlt(canvas.Handle,0,0,width,height,Bitmap.Canvas.Handle,0,0,Bitmap.Width,Bitmap.Height,srccopy);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Bitmap:=TBitmap.Create;
  Bitmap.LoadFromFile('1.bmp');
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  sendmessage(self.Handle,WM_Paint,0,0);
end;




原文地址:https://www.cnblogs.com/xe2011/p/2532911.html