加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-17 07:17:52 所属栏目:百科 来源:网络整理
导读:我需要一些方法来了解表单何时完成加载.我的理由是我有一个加载此表单时加载的第二个表单.从form1.load调用此代码. Form2当前正在form1后面显示,因为我猜测form1在加载结束时调用了activate或类似的东西,因此覆盖了form2上的任何Activate,BringToFront等调用
我需要一些方法来了解表单何时完成加载.我的理由是我有一个加载此表单时加载的第二个表单.从form1.load调用此代码.

Form2当前正在form1后面显示,因为我猜测form1在加载结束时调用了activate或类似的东西,因此覆盖了form2上的任何Activate,BringToFront等调用.

如果你查看下面的代码,我已经尝试在调用ShowAlloactionSearchDialog()之后添加frmAllocationSearch.Activate,frmAllocationSearch.BringToFront和Me.SendToBack,但这些都被浪费了,因为在load事件被触发之后发生了一些事情前方.

代码是:

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读