D
D
David Manzhula2015-11-25 23:43:34
Delphi
David Manzhula, 2015-11-25 23:43:34

How to take a screenshot in Delphi, process (colors), crop and paste into a picture on a form without saving to a file?

How to take a screenshot in Delphi, process (colors), crop and paste into a picture on a form without saving to a file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2015-11-26
@da411d

The screenshot is done like this.

procedure TForm1.Button1Click(Sender: TObject);
var
  bmp:TBitmap;
begin
  bmp := TBitmap.Create;
  try
    bmp.PixelFormat := pf32bit;   // сейчас не нужно, но, вероятно, потребуется при обработке
    bmp.Width := Screen.Width;
    bmp.Height := Screen.Height;
    BitBlt(bmp.Canvas.Handle, 0,0, Screen.Width, Screen.Height,
           GetDC(0), 0,0,SRCCOPY);
    imgScreen.Picture.Assign(bmp);  // теста ради выведем на Image; в боевой проге не нужно
  finally
    bmp.Free;
  end;
end;

And once you get a screenshot in TBitmap, do what you want with it. Goat color, process it somehow ... How - this is another question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question