Code: |
{**********************************************} // by Daniel Wischnewski Sometimes you want to take a screen shot, however often Windows has trouble with big data amounts and becomes very slow. The simple solution is to make many small screen shots and paste the result together. It''s not light speed, however often faster than taking the whole screen at once. const cTileSize = 50; function TForm1.GetSCREENSHOT: TBitmap; var Locked: Boolean; X, Y, XS, YS: Integer; Canvas: TCanvas; R: TRect; begin Result := TBitmap.Create; Result.Width := Screen.Width; Result.Height := Screen.Height; Canvas := TCanvas.Create; Canvas.Handle := GetDC(0); Locked := Canvas.TryLock; try XS := Pred(Screen.Width div cTileSize); if Screen.Width mod cTileSize > 0 then Inc(XS); YS := Pred(Screen.Height div cTileSize); if Screen.Height mod cTileSize > 0 then Inc(YS); for X := 0 to XS do for Y := 0 to YS do begin R := Rect( X * cTileSize, Y * cTileSize, Succ(X) * cTileSize, Succ(Y) * cTileSize); Result.Canvas.CopyRect(R, Canvas, R); end; finally if Locked then Canvas.Unlock; ReleaseDC(0, Canvas.Handle); Canvas.Free; end; end; |
©
- << Назад
- Вперёд
Просьба писать ваши замечания, наблюдения и все остальное,
что поможет улучшить предоставляемую информацию на этом сайте.
ВСЕ КОММЕНТАРИИ МОДЕРИРУЮТСЯ ВРУЧНУЮ, ТАК ЧТО СПАМИТЬ БЕСПОЛЕЗНО!