Noob VB.NEt表单创建顺序问题 [英] Noob VB.NEt Form Creation Order Question
问题描述
我在表单创建顺序方面遇到问题。我正在工作线程中创建一个表单,但是除非我使表单可见,否则控件不能正确初始化。
I am having trouble with form creation order. I am creating a form in a worker thread, but the controls don't get initalised correctly unless I make the form visible.
所以例如
dim F As New WorkerForm
dim F As New WorkerForm
Rem ***动态创建控件***
Rem *** Dynamically create controls ***
WorkerForm.Init
WorkerForm.Init
在WorkerForm.init中我启用了一个计时器,但是在表单变得可见之前计时器才会运行。我假设这是因为在显示表单之前不会创建表单窗口,因此不会处理基础WM_TIMER消息
In WorkerForm.init I am enabling a timer, but the timer does not run until the form becomes visible. I am assuming this is because the forms window isn't being created until the form is shown and therefore won't be processing the underlying WM_TIMER messages
我的问题是我可以强制表单创建它的窗口而不显示它?
My question is can I force the form to create it's window without showing it ?
我正在使用dot Net framework 4.5.2 在Windows 10上
I am using the dot Net framework 4.5.2 on windows 10
推荐答案
您好
我想您可能需要使用F变量而不是WorkerForm。大概你已经在此之前创建了WorkerForm。
I think you may need to use the F variable instead of the WorkerForm. Presumably you have already created the WorkerForm prior to this.
如果你有点生疏,为什么不使用Designer?
If you are a bit rusty, why not use the Designer?
这篇关于Noob VB.NEt表单创建顺序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!