本文整理自网络,侵删。
//-------------------------------------------------------------------------------------------- function getDateFilename():string; var s:string; begin DateTimeToString(s,'yyyymmddhhnnsss',now()); result:=s; end;//截屏function captureScreen(x1:integer;y1:integer;x2:integer;y2:integer):tbitmap;var dc:HDC; bmp:tbitmap; fullCanvas:TCanvas;begin dc:=GetDC(0); fullCanvas:=TCanvas.Create; fullCanvas.Handle:=dc; bmp:=TBitmap.Create; try bmp.Width:=abs(x2-x1); bmp.Height:=abs(y2-y1); bmp.Canvas.CopyRect(Rect(0,0,bmp.Width,bmp.Height),fullCanvas,Rect(x1,y1,x2,y2)); //bmp.SaveToFile('c:\tmp\1.bmp'); finally end; result:=bmp;end; //*************** Draw Cursor on the bitmap ******************Function DrawCursor(Bit : TBitmap) : TBitmap;VarCur : TCursorInfo;Icn : TIcon;IcnInfo : TIconInfo;Rec : TRect;beginIcn := TIcon.Create;Rec := Bit.Canvas.ClipRect;tryCur.cbSize := SizeOf(Cur);if GetCursorInfo(Cur) thenif Cur.flags = CURSOR_SHOWING thenbeginIcn.Handle := CopyIcon(Cur.hCursor);if GetIconInfo(Icn.Handle, IcnInfo) thenBit.Canvas.Draw(Cur.ptScreenPos.X - Integer(IcnInfo.XHotSpot) - Rec.Left,Cur.ptScreenPos.Y - Integer(IcnInfo.YHotSpot) - Rec.Top,Icn);end;finallyIcn.Free;end;Result := Bit;end;//************ End of cursor drawing *************************
相关阅读 >>
Delphi firedac 连接access mdb数据库的方法
Delphi 2009 之 tcategorypanelgroup[1]: chevronalignment 等
更多相关阅读请进入《Delphi》频道 >>