Recent

Author Topic: Capture Screen area - Repaint low  (Read 1540 times)

laguna

  • Sr. Member
  • ****
  • Posts: 269
Capture Screen area - Repaint low
« on: May 09, 2018, 08:50:45 am »
Hi, help me,

In this program, capture area screen, with mouse, refresh low e repaint  is bad.

without the repaint, capture area screen is correct, but not display rectangle area, with mouse.

Code: Pascal  [Select]
  1. procedure TfrmScreenShot.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  2. begin
  3.   if FMakingSelection then begin
  4.     FSelectionRect.Right:=X;
  5.     FSelectionRect.Bottom:=Y;
  6.     Repaint;        //  <---------------------------
  7.   end;
  8. end;
  9.  
  10. procedure TfrmScreenShot.FormMouseUp(Sender: TObject; Button: TMouseButton;
  11.   Shift: TShiftState; X, Y: Integer);
  12. begin
  13.   if FMakingSelection then begin
  14.     FMakingSelection:=False;
  15.     FSelectionMade:=True;
  16.     Repaint;  //  <---------------------------
  17.     SaveSelectedRegion;
  18.     Close;
  19.   end;
  20. end;  
  21.  

Help me for optimize this.

Thanks.
Vincenzo


Thaddy

  • Hero Member
  • *****
  • Posts: 8515
Re: Capture Screen area - Repaint low
« Reply #1 on: May 09, 2018, 08:57:16 am »
form.beginupdate/endupdate would help.
Read the manuals and if you are a professional get a proper education in computer science. Makes the forum a lot cleaner.

laguna

  • Sr. Member
  • ****
  • Posts: 269
Re: Capture Screen area - Repaint low
« Reply #2 on: May 09, 2018, 09:10:35 am »
I do not understand how to use it, can you help me?

Thank you
Vincenzo


GetMem

  • Hero Member
  • *****
  • Posts: 3478
Re: Capture Screen area - Repaint low
« Reply #3 on: May 09, 2018, 11:41:01 am »
You should really switch to something more performant like BGRABitmap or something similar. Until then try the attached project(tested only on windows).

laguna

  • Sr. Member
  • ****
  • Posts: 269
Re: Capture Screen area - Repaint low
« Reply #4 on: May 09, 2018, 01:36:31 pm »
Run very well.


 Thanks.