WindowsFormsApplicationBase.SplashScreen 属性

定义

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

public:
 property System::Windows::Forms::Form ^ SplashScreen { System::Windows::Forms::Form ^ get(); void set(System::Windows::Forms::Form ^ value); };
public System.Windows.Forms.Form SplashScreen { get; set; }
member this.SplashScreen : System.Windows.Forms.Form with get, set
Public Property SplashScreen As Form

属性值

应用程序的初始屏幕。

例外

相同的值被赋予此属性和 MainForm 属性。

示例

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

Private Sub MyApplication_Startup(
    sender As Object,
    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 的属性来更新其用户界面。

必须在应用程序事件的“代码编辑器”窗口中输入此代码。 有关详细信息,请参阅 Application Page, Project Designer (Visual Basic)(应用程序页、项目设计器 (Visual Basic)。

注解

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

此属性支持 Visual Basic 应用程序模型。 有关详细信息,请参阅 Visual Basic 应用程序模型概述

应用程序关闭时,不会保留对此属性所做的更改。 若要永久更改初始屏幕,必须更改 Project Designer中的设置。

可用性(按项目类型)

项目类型 可用
Windows 窗体应用程序
类库
控制台应用程序
Windows 窗体控件库
Web 控件库
Windows 服务
网站

适用于

另请参阅