【问题标题】:Windows Application Framework Properties in Visual Studio 2010Visual Studio 2010 中的 Windows 应用程序框架属性
【发布时间】:2012-09-26 07:01:00
【问题描述】:

为了让您熟悉正在发生的事情,我正在 Visual Studio 2010 PRO 中处理我的个人项目。它是一个桌面/表单应用程序,我的项目中有一个闪屏。启动画面应该加载并保持焦点几秒钟,然后应该关闭;让主窗体呈现。

当我运行应用程序时,闪屏屏幕会显示,然后它会关闭并结束整个应用程序。我相信我需要更改“Windows 应用程序框架属性”中的默认设置,但它是灰色的,我无法进行任何选择。 (在解决方案资源管理器中右键项目文件 --> 应用程序 --> Windows 应用程序框架)

如果您知道我可以如何配置这些设置,请提供一些帮助。同时,我强制使用frmSplashScreen.Hide()让它工作,当我想让程序停止时点击Stop Debugging,这不是很实用。

提前致谢。我复制了下面的一些代码。

Private Sub tmrSplashScreen_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSplashScreen.Tick
        'Close the form after time value specified
        Me.Hide()
        frmHomeScreen.Show()
        frmHomeScreen.Focus()
    End Sub

【问题讨论】:

  • 您应该确保从您的父母那里打开文件。在这种情况下,这将是主要形式。

标签: vb.net visual-studio-2010 ide


【解决方案1】:

主要形式

dim splshScreen as frmSplashscreen = New frmSplashscreen()

 private sub openSplashscreen()

     'you are showing who is the parent by sending "me" with the showdialog
     splshScreen.showdialog(me)
 end sub

飞溅形式

Private Sub frmSplashscreen(sender As Object, e As System.EventArgs) Handles Me.Load

'Do something cool to load anything

  if load = true then
     me.close()
  end if 

end sub

所以基本上在打开对话框的情况下发送父级。然后给你的负载一个条件,并确保它在完成后关闭。如果你只是使用 me.close 它应该没问题并自行关闭

【讨论】:

  • 非常感谢您对我的帮助。该程序目前正在按照我想要的方式运行(就整个应用程序而言,甚至还不是冰山一角)。我对初始屏幕的关闭语句放置在一个滴答事件中。虽然,我仍然想知道为什么项目属性中的选项是灰色的,并阻止我改变那里的行为。
最近更新 更多