源码 ; ;源码 ; ;源码 ; ;源码
procedure TForm1.ButtonSnapShotClick(Sender: TObject);
var
; Bitmap: TBitmap; ; ; // holds a bitmap
begin
; {see which radio button is checked}
; if ImageOptions.ItemIndex = 0
; then keybd_event(VK_SNAPSHOT,1,0,0) ; ;{desktop window snapshot}
; else keybd_event(VK_SNAPSHOT,0,0,0); ; {client window snapshot}
; {check to see if there is a picture}
; if Clipboard.HasFormat(CF_BITMAP) then
; begin
; ; {Create a bitmap to hold the contents of the Clipboard}
; ; Bitmap := TBitmap.Create;
; ; {trap for clipboard bitmap errors}
; ; try
; ; ; {get the bitmap off the clipboard using Assign}
; ; ; Bitmap.Assign(Clipboard);
; ; ; {copy the bitmap to the Image}
; ; ; Image1.Canvas.Draw(0, 0, Bitmap);
; ; finally
; ; ; {the bitmap is no longer needed, so free it}
; ; ; Bitmap.Free;
; ; end;
; end;
end;