What's the easiest way to write a please wait screen with Delphi?

前端 未结 6 587
感动是毒
感动是毒 2020-12-11 12:03

I just want a quick and dirty non-modal, non-closable screen that pops up and goes away to make 2 seconds seem more like... 1 second. Using 3-5 lines of code.

6条回答
  •  庸人自扰
    2020-12-11 12:58

    I think that's too much to ask. There's no "magic." Having a window come up with specific attributes takes a lot of information to describe those specific attributes, and that has to come from somewhere. Giving it specific behavior means code that has to come from somewhere too. The VCL makes it a lot easier, but you still need to set up the form.

    I'd just set up a form of the right size in the Form Designer. Give it a BorderStyle of bsNone, and you get no close box. (But no border either. Or you can make it bsDialog and give it an OnCloseQuery event that always sets CanClose to false.) Give it a TLabel that says "Please Wait," and a TTimer that calls Self.Release after 2 seconds.

    Not very Code-Golf-ish, but it'll work and it's simple to set up.

提交回复
热议问题