lcl: add TCustomForm.GetFormImage from Gerard Visent (issue #0011292 with modifications)

git-svn-id: trunk@15127 -
This commit is contained in:
paul 2008-05-14 06:43:38 +00:00
parent 5860bfb71a
commit 1fe620b00a
2 changed files with 19 additions and 1 deletions

View File

@ -523,9 +523,10 @@ type
procedure RemoveHandlerClose(OnCloseHandler: TCloseEvent);
procedure AddHandlerCreate(OnCreateHandler: TNotifyEvent; AsLast: Boolean=true);
procedure RemoveHandlerCreate(OnCreateHandler: TNotifyEvent);
function IsShortcut(var Message: TLMKey): boolean; virtual;
function IsShortcut(var Message: TLMKey): boolean; virtual;
procedure IntfDropFiles(const FileNames: Array of String);
procedure IntfHelp(AComponent: TComponent);
function GetFormImage: TBitmap;
public
// drag and dock
procedure Dock(NewDockSite: TWinControl; ARect: TRect); override;

View File

@ -1766,6 +1766,23 @@ begin
end;
end;
function TCustomForm.GetFormImage: TBitmap;
var
ARect: TRect;
begin
Result := TBitmap.Create;
try
Result.Width := ClientWidth;
Result.Height := ClientHeight;
LCLIntf.GetWindowRect(Handle, ARect);
with GetClientOrigin do
PaintTo(Result.Canvas, ARect.Left - X, ARect.Top - Y);
except
Result.Free;
raise;
end;
end;
{------------------------------------------------------------------------------
Method: TCustomForm.CreateWnd
Params: None