Re:using bitblt function
Something like this?
procedure FillAndBlitRect(bmp: TBitmap; w,h: integer; pClr,bClr:
TColor;xpos,ypos: integer;ToDC: hDC);
begin
bmp.Width := w;
bmp.Height := h;
bmp.Canvas.Pen.Color := pClr;
bmp.Canvas.Brush.Color := bClr;
bmp.Canvas.Rectangle(0,0,w,h);
BitBlt(ToDC,xpos,ypos,w,h,bmp.Canvas.Handle,
0,0,SRCCOPY);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
b : TBitmap;
begin
b := TBitmap.Create;
FillAndBlitRect(b,128,128,clBlack,clRed,60,60,Form1.Canvas.Handle);
b.Free;
end;
--
Harm
http://www.users.uswest.net/~sharman1/
Cool Graphics, for free!
Quote
"Ran Kornfeld" <rank...@internet-zahav.net> wrote in message
news:397acd8b_2@dnews...
Quote
> Hello
> I am trying to do Double buffering by creating a memory DC and painting a
> filled rectangle to it , and then using bitblt, copy it to the window's
DC.
> It doesn't worked for me, I think the problem was in painting to the
memory
> DC.
> Has someone done it and can give me some sample code??
> Thanks
> Ran