如何在 FireMonkey 中创建闪屏?
我需要在 FMX 程序启动时创建一个启动屏幕。
VCL 中的以下代码不再起作用:
SplashScreen := TSplashScreen.Create(Application);
SplashScreen.Show;
Application.Initialize;
SplashScreen.Update; //No such function in FMX
Application.Run;
问题是,在 FMX 中,直到执行 Application.Run
后才会创建/重新绘制表单,因为它们使用一些 FMX 魔法来重新绘制。使用 VCL 启动画面不是一个选项,因为我需要 OSX 支持。
如何在 Delphi XE2 FireMonkey 项目中创建启动屏幕?
I need to create a splashscreen while my FMX program is launching.
The following code from VCL does not works anymore:
SplashScreen := TSplashScreen.Create(Application);
SplashScreen.Show;
Application.Initialize;
SplashScreen.Update; //No such function in FMX
Application.Run;
Problem is that in FMX forms are not created/repainted until Application.Run
executed, as they use some FMX magic to repaint. Using VCL splashscreen is not an option since I need OSX support.
How do I create a splashscreen in Delphi XE2 FireMonkey project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是有效的 - 区别在于
Application
并未成为启动窗口的Owner
,并且Application.Initialize
在创建并显示启动窗口,但直到启动窗口显示后才创建主窗体。This works - the difference being that the
Application
isn't made theOwner
of the splash window, and thatApplication.Initialize
is called before the splash window is created and displayed, but the main form isn't created until after the splash window is showing.您还可以添加单独的 TLayout 并根据需要填充它。这样做;
注意:这种方法不会在启动屏幕上显示标准表单按钮。
我已经这样做过很多次了,事实证明,它比制作一个单独的表单并与主表单一起处理要简单得多。
You can also add a separate TLayout and populate it as you desire. To do so;
Note: This approach though doesn't show the standard form buttons on the splash screen.
I have done this many a times and it proves to be quiet less complicated than making a separate form and handling it alongside the main form.