gpt4 book ai didi

加载事件后的 VB.NET .NET?

转载 作者:行者123 更新时间:2023-12-05 00:42:03 25 4
gpt4 key购买 nike

我需要某种方式知道表单何时完成加载。我的理由是我有第二个表单,当这个表单加载时会加载。从 form1.load 调用此代码.
Form2当前显示在 form1 后面正如我所猜测的 form1在加载结束时调用 activate 或类似的方法,因此任何 Activate、BringToFront 等都会调用 form2被覆盖。

如果您查看下面的代码,我尝试添加 frmAllocationSearch.Activate , frmAllocationSearch.BringToFrontMe.SendToBack调用 ShowAlloactionSearchDialog() 后,但是这些都被浪费了,因为在加载事件被触发以带来 Me 之后发生了一些事情。到前面。

代码是:

Private Sub Allocation_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Load

ShowAlloactionSearchDialog()
End Sub

Private Sub ShowAlloactionSearchDialog()

If frmAllocationSearch Is Nothing OrElse frmAllocationSearch.IsDisposed Then
frmAllocationSearch = New AllocationSearch
frmAllocationSearch.MdiParent = Me.MdiParent
frmAllocationSearch.Info = Me.Info
frmAllocationSearch.Top = Me.Top
frmAllocationSearch.Left = Me.Left + Me.Width - frmAllocationSearch.Width
frmAllocationSearch.AllocationWindow = Me

frmAllocationSearch.Show()
Else
If frmAllocationSearch.WindowState = FormWindowState.Minimized Then
frmAllocationSearch.WindowState = FormWindowState.Normal
End IF
frmAllocationSearch.Activate()
End If
End Sub

最佳答案

也许你可以试试Form.Activated事件。

Occurs when the form is activated in code or by the user.

关于加载事件后的 VB.NET .NET?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2431797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com