超级菜鸟回答超难题:
---------------------------------------------------------
来自:卷起千堆雪tyn, 时间:2002-3-6 10:48:00, ID:963377
应该在 OnPaint事件中实现
procedure TForm1.FormPaint(Sender: TObject);
var
Bmp :TBitmap;
begin
Bmp :=TBitmap.Create;
Bmp.LoadFromFile('c:/10.bmp');
Canvas.Draw(0,0,Bmp);
Canvas.Refresh;
Bmp.Free;
end;
---------------------------------------------------
来自:DNChen, 时间:1999-10-24 2:10:00, ID:145496
我一般是这么写的,
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('MyBitmap.bmp');
Canvas.Brush.Bitmap := Bitmap;
Canvas.FillRect(ClientRect);
finally
Form1.Canvas.Brush.Bitmap := nil;
Bitmap.Free;
end;
-----------------------------------------------------
来自:tom518, 时间:1999-9-20 10:07:00, ID:135883
FClientInstance, FPrevClientProc : TFarProc;
procedure ClientWndProc(var Message: TMessage);
//定义变量与过程
procedure TForm1.FormCreate(Sender: TObject);
begin
FClientInstance:= MakeObjectInstance(ClientWndProc);
FPrevClientProc:= Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TForm1.ClientWndProc(var Message: TMessage);
var
MyDC:hDC;
Ro,Co:Word;
begin //在窗体上画背景
if message.Msg<>WM_ERASEBKGND then begin
message.Result := CallWindowProc(FPrevClientProc,ClientHandle, message.Msg,message.wParam,message.lParam);
exit;
end;
MyDC := TWMEraseBkGnd(Message).DC;
for Ro := 0 to ClientHeight div Image1.Picture.Height do begin
for Co := 0 TO ClientWIDTH div Image1.Picture.Width do begin
BitBlt(MyDC, Co*Image1.Picture.Width, Ro*Image1.Picture.Height,
Image1.Picture.Width, Image1.Picture.Height,
Image1.Picture.Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
message.Result:= 1;
end;
end;
end;
-----------------------------------------------------------
......