mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 11:02:16 +01:00 
			
		
		
		
	 149d3a219a
			
		
	
	
		149d3a219a
		
	
	
	
	
		
			
			- fix screenshot example bug (use GetDC(0) instead of DC = 0) - fix image example - clear LazIntfImage before experiments (part of issue #0019123) - remove all .lrs, .rc files and use .lfm, .res instead git-svn-id: trunk@30244 -
		
			
				
	
	
		
			52 lines
		
	
	
		
			805 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			805 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| unit screenshotunit;
 | |
| 
 | |
| {$mode objfpc}{$H+}
 | |
| 
 | |
| interface
 | |
| 
 | |
| uses
 | |
|   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
 | |
|   ExtCtrls, Buttons, LCLType, LCLIntf;
 | |
| 
 | |
| type
 | |
| 
 | |
|   { TfrmScreenshot }
 | |
| 
 | |
|   TfrmScreenshot = class(TForm)
 | |
|     btnScreenshot: TBitBtn;
 | |
|     imgScreenshot: TImage;
 | |
|     procedure btnScreenshotClick(Sender: TObject);
 | |
|   private
 | |
|     { private declarations }
 | |
|   public
 | |
|     { public declarations }
 | |
|   end; 
 | |
| 
 | |
| var
 | |
|   frmScreenshot: TfrmScreenshot;
 | |
| 
 | |
| implementation
 | |
| 
 | |
| {$R *.lfm}
 | |
| 
 | |
| { TfrmScreenshot }
 | |
| 
 | |
| procedure TfrmScreenshot.btnScreenshotClick(Sender: TObject);
 | |
| var
 | |
|   bmp: TBitmap;
 | |
|   DC: HDC;
 | |
| begin
 | |
|   bmp := TBitmap.Create;
 | |
|   DC := GetDC(0);
 | |
|   try
 | |
|     bmp.LoadFromDevice(DC);
 | |
|   finally
 | |
|     ReleaseDC(0, DC);
 | |
|   end;
 | |
|   imgScreenshot.Picture.Bitmap.Assign(bmp);
 | |
|   FreeAndNil(bmp);
 | |
| end;
 | |
| 
 | |
| end.
 | |
| 
 |