For windows.
procedure TForm1.Button1Click(Sender: TObject);
Var
B:TBitMap;
R:TRect;
begin
GetWindowRect(Handle, R);
B:= TBitMap.Create;
B.SetSize(R.Width,R.Height);
SendMessage(Handle,WM_PRINT,B.Canvas.Handle,PRF_CHILDREN or PRF_NONCLIENT or PRF_CLIENT);
Form2.Canvas.Draw(0,0,B);
B.Free;
end;
This will capture the complete form frame even if it's off the screen a bit, however, you need to ensure the form's client area is fully exposed, which means no scrollbars to capture all of it.
So, prior to capturing the image, you need to ensure the form is large enough where the complete client area is visible, even if it's off screen, then you will get the complete image along with the FRAME.
One note here with windows, you will get the XP style frame, not the style you see starting like in Vista.
Also, you can add "PRF_OWNED" to the list to capture other types of controls within the client area.