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;




posted @ 2012-06-03 17:56  XE2011  阅读(210)  评论(0编辑  收藏  举报