Re:BitBlt copies wrong canvas...
Quote
Mojo <m...@2die4.com> wrote:
> The idea is to copy the area behind my component, but instead of
copying the
> form, I get the background of my desktop. I guess that somehow the
BitBlt is
> done before the form is created.
If I understand your question correctly you want to copy the area behind
your component. Here is a function that I use in some transparent
components I have written:
procedure DrawParentImage(Control: TControl; Dest: TCanvas);
var
SaveIndex: Integer;
DC: HDC;
Point: TPoint;
begin
with Control do
begin
if Parent = nil then
Exit;
DC := Dest.Handle;
SaveIndex := SaveDC(DC);
GetViewportOrgEx(DC, Point);
SetViewportOrgEx(DC, Point.X - Left, Point.Y - Top, nil);
IntersectClipRect(DC, 0, 0, Parent.ClientWidth,
Parent.ClientHeight);
Parent.Perform(WM_ERASEBKGND, DC, 0);
Parent.Perform(WM_PAINT, DC, 0);
RestoreDC(DC, SaveIndex);
end;
end;
<<
Bill