My.Application.SplashScreen 属性

更新:2007 年 11 月

获取和设置此应用程序的初始屏幕。

' Usage
Dim value As System.Windows.Forms.Form = My.Application.SplashScreen
' Declaration
Public Property SplashScreen As System.Windows.Forms.Form

返回值

该应用程序用作初始屏幕的 Form 对象。

异常

下面的情况可能会导致异常:

备注

My.Application.SplashScreen 属性允许您获取和设置应用程序用作初始屏幕的 Form 对象,初始屏幕是应用程序启动时显示的第一个图形窗体。

此属性支持 Visual Basic 应用程序模型。有关更多信息,请参见 Visual Basic 应用程序模型概述

应用程序关闭时,不会保留对此属性的更改。若要永久更改初始屏幕,必须在“项目设计器”中更改设置。有关更多信息,请参见如何:为应用程序指定初始屏幕 (Visual Basic)

示例

此示例使用 My.Application.SplashScreen 属性和 My.Application.Startup 事件在应用程序启动时用状态信息更新初始屏幕。

Private Sub MyApplication_Startup( _
    ByVal sender As Object, _
    ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs _
) Handles Me.Startup
    ' Get the splash screen.
    Dim splash As SplashScreen1 = CType(My.Application.SplashScreen, SplashScreen1)
    ' Display current status information.
    splash.Status = "Current user: " & My.User.Name
End Sub

此示例要求项目具有名为 SplashScreen1 的初始屏幕。初始屏幕需要具有名为 Status 的属性来更新它的用户界面。

必须在应用程序事件的“代码编辑器”窗口中输入此代码。有关更多信息,请参见如何:处理应用程序事件 (Visual Basic)

要求

命名空间:Microsoft.VisualBasic.ApplicationServices

类:WindowsFormsApplicationBase

**程序集:**Visual Basic Runtime Library(位于 Microsoft.VisualBasic.dll 中)

按项目类型列出可用性

项目类型

可用

Windows 应用程序

类库

控制台应用程序

Windows 控件库

Web 控件库

Windows 服务

网站

权限

不需要任何权限。

请参见

参考

My.Application 对象

My.Application.MinimumSplashScreenDisplayTime 属性

System.Windows.Forms.Form

WindowsFormsApplicationBase.SplashScreen