Prevent image blinking when timer is used

Asked

Viewed 274 times

1

I have a background image in my application, but it gives the impression of blinking due to the use of a Ttimer that the application has.

I tried to change the interval of Ttimer but the problem persists.

Any tips on how to solve?

Timer code:

procedure TfrmPrincipal.Timer1Timer(Sender: TObject);
begin

if ( TimeToStr(time) < '05:00:00' ) or ( TimeToStr(time) > '24:00:00' ) then Application.Terminate;

    if (timetostr(time) >= '23:50:00') and (timetostr(time) <= '24:00:00') then
    begin
    Timer1.Enabled := false;
    if frmmodulo.qrcaixa_operador.FIELDBYNAME('situacao').AsInteger = 1 then
    begin
    application.messagebox(Pchar('Já são ' + timetostr(time) +
    ' e o Caixa do dia ' + datetostr(frmmodulo.qrcaixa_operador.FIELDBYNAME
    ('data').asdatetime) + #13 + 'Ainda não foi fechado! Verifique!'),
    'Atenção', mb_ok + mb_iconwarning);
    end;
    Timer1.Enabled := true;
    end;

end;
  • Tell us what language you are using. Is the App Desktop, Web, Mobile? Provide more details to help us help you.

  • How are you rendering it?

  • @Qmechanic73 No timer is seen the time to know if it is near 12h.

  • @Renattomachado is in Delphi, desktop application

  • @Viníciusgobboa.deOliveira, I just use a Timage and place a jpeg image

  • 1

    Post your event OnTimer.

  • @Wineusgobboa.deOliveira posted

  • 2

    Unfortunately there’s nothing pointing to it. There’s something causing a invalidate in your form, which causes it to be rendered again. The only thing in this method that would do that is the MessageBox when executed. Did you check if your form is using double buffering? Enabling double buffering will not remove the "redesign" of the form, but will probably make the blink disappear.

  • 2

    Solved with this @Viníciusgobboa.deOliveira. Add as reply so I can mark as accepted. Thank you very much

Show 4 more comments

1 answer

0


Reply from Vinicius Gobbo A. de Oliveira:

Unfortunately there’s nothing pointing to it. There’s something causing a invalidate in your form, which causes it to be rendered again. The only thing in this method that would do this is Messagebox when executed. You have checked whether your form is using double buffering? Enabling double buffering will not remove the "redesign" of the form, but will probably make the blink disappear.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.