语言

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 更新其用户界面的属性。

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

注解

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

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

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

按项目类型提供可用性

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

适用于

另请参阅