Search code examples
delphitform

Delphi: is it possibile in the OnFormShow event to tell a form not to display even for a millisecond?


In the OnFormShow event I need (for a particular set of conditions) not to show the form.

Something like "if counter > 15 don't show the form".

I could of course refactor and move many things on form create, but this is a lot of work, because this is a common form and there are too many changes involved.

Now I close the form at the end of OnFormShow but anyway I see the form appear for some milliseconds.

Unfortunately the condition that tells me not to show the form is decided inside OnFormShow. Is there a trick to avoid the form to show?


Solution

  • +1 on the refactoring, but in the mean time, try this:

    AlphaBlend := true;

    AlphaBlendValue := 0;

    That should make the form invisible, and seemed to work in my OnShow test app (D2010/XP). I'm guessing you'll need to add code to make the form close, possibly a timer?