- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想创建一个启动屏幕(在主窗体之前),该屏幕将显示 x 秒,但我不想延迟主窗体的创建 x 秒。
因此,我创建启动屏幕表单,创建主表单,然后在 x 秒后关闭启动屏幕表单。
据我了解,用 CreateForm 创建的第一个表单是主表单。这是正确的吗?
begin
Application.Initialize;
Application.MainFormOnTaskbar := FALSE;
Application.Title := AppName;
frmSplash:= TfrmSplash.Create(NIL); <----- not main form??
Application.CreateForm(TfrmMain, frmMain); <----- main form??
frmMain.LateInitialization;
frmMain.show;
Application.Run;
end.
关闭启动窗体
启动画面有一个 TTimer。计时器在启动窗体中执行一些动画,并在 x 秒后关闭窗体:
procedure TfrmSplash.CloseSplashForm;
begin
Timer.Enabled:= FALSE;
Close; <-- I do see the program reaching this point
end;
但是,应用程序在关闭时泄漏内存:
5 - 12 bytes: TMoveArrayManager<System.Classes.TComponent> x 4, Unknown x 2
13 - 20 bytes: TObservers x 1, TList x 3, Unknown x 3
21 - 36 bytes: TComponent.GetObservers$942$ActRec x 1, TPen x 2, TIconImage x 1, TPadding x 1, TBrush x 3, TTouchManager x 2, TMargins x 2, TSizeConstraints x 2, TList<System.Classes.TComponent> x 4, UnicodeString x 3, Unknown x 6
37 - 52 bytes: TDictionary<System.Integer,System.Classes.IInterfaceList> x 1, TPicture x 1, TGlassFrame x 1, TFont x 4
53 - 68 bytes: TIcon x 1
69 - 84 bytes: TControlScrollBar x 2
85 - 100 bytes: TTimer x 1
101 - 116 bytes: TControlCanvas x 2
149 - 164 bytes: Unknown x 2
437 - 484 bytes: TImage x 1
917 - 1012 bytes: TfrmSplash x 1
看起来 frmSplash 实际上并未被释放。
最佳答案
向启动窗体添加一个OnClose事件并设置
Action := caFree;
关于delphi - 如何在MainForm之前创建一个表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45611162/
如何显示需要同步运行的表单。我尝试从线程池的 queueworker 运行 application.run - 但有时我有一些无效的句柄。尝试使用常规线程,但是当主窗体关闭时它不会关闭它 - 我真的不
本次将要很大家分享的是一个跨平台运行的服务插件 - TaskCore.MainForm,此框架是使用.netcore来写的,现在netcore已经支持很多系统平台运行了,所以将以前的Task.Mai
我的应用程序有多种形式,还有一种更重要的形式,即主要形式,其行为通常可以,但是在相同情况下(例如,当我从子表单中打开文件对话框时),行为是:子表单被隐藏并显示主窗体。 如何避免这种情况? 最佳答案 确
连接到数据库后是否可以从“可用”表单列表中选择一个表单(作为主表单)?我有一个带有 3 个“可用”表单的数据模块。暂时没有主表单。首先创建数据模块。现在,我想根据用户登录的数据库选择表单,并将其设为主
这是 *.dpr : program Project1; uses Vcl.Forms, Unit1 in 'Unit1.pas' {Form1}, Unit2 in 'Unit2.pas
我有这个 MainForm 类: namespace homework_001{ public partial class MainForm : Form { public MainForm(
这个问题在这里已经有了答案: How do I prevent the app from terminating when I close the startup form? (4 个答案) 关闭
我有以下类(class): public class CreateNewWeapon : BaseWeapon { string[] weaponNames = { "Dragonsl
在我们现有的代码中,我们有很多这样的代码,其中以 MainForm 作为所有者(例如,而不是 nil)创建表单,但我们显式地释放它。 function SomeFunc(): Boolean; var
如何从后台任务向主窗体发送消息 (TOmniMessage)? 我想向 Mainform 发送以下消息: Memo1.Lines.Add(Format('BEGIN: %s', [msg.MsgDat
我想在我的 Mainform 上制作面板的屏幕截图。这个屏幕截图应该是在用户在子表单上选择了一些选项之后制作的。一开始一切顺利,但现在屏幕截图包含部分子表单。 子表单像这样打开: private vo
我正在使用 Borland c++ builder。我有一个应用程序,我希望隐藏主表单,直到在不同的表单上按下按钮。我已经将主窗体上的 Visible 值设置为 false,但是当我运行程序时它仍然显
当我将 TRibbon 控件放置在不是应用程序 MainForm 的窗体上时,TRibbon 的操作(即剪切、粘贴)将始终在执行操作后将焦点返回到 MainForm。 即使保存 TRibbon 的 T
我有一个导出 DLL 并具有 library header 的 Delphi 2010 应用程序。它在 TThread 中创建其 MainForm,如下所示: var ActiveThread:
我对编程还很陌生,并且已经开始了一个项目,我试图将程序的功能分成类,每个类处理与程序的特定部分相关的大部分内容。 我有一个名为 DirectoryMonitors 的类,它创建一个对象来监视带有 Fi
我有一个 MainForm 类,我有一个函数来检索存储在我的数据库中的设置。 到现在为止还挺好。 然后,我有一个在启动时加载的插件 (DLL),但我想使用相同的函数来检索我的 DLL 中的设置。 如果
我可以在不引用构造函数中的对象的情况下执行此操作吗?也就是说,任何继承自FrmTaoChild的类在创建时都必须在主窗口的工具栏上添加按钮 public class FrmTaoMain extend
我正在尝试在 MainForm 的 datagridview 中显示数据。我正在创建客户表单中添加客户。 private void createButton_Click(object sender,
我的应用程序使用 Message.hpp 中的 SendStructMessage() 函数通过传入消息填充一些面板。 SendStructMessage() 需要一个有效的窗口句柄才能发送到。 我已
我有两个类(class)。 Public Class MainForm Private Project As clsProject Private Sub btnDo_Click ..
我是一名优秀的程序员,十分优秀!