Close a windows form without exiting the entire application

前端 未结 4 2003
梦如初夏
梦如初夏 2020-12-21 09:19

Environment

  • Windows XP SP3 x32
  • Visual Studio 2005 Standard
  • Device/Platform: Honeywell Dolphin 9500 with Windows Mobile/Pocket PC 2003
相关标签:
4条回答
  • 2020-12-21 09:38

    Create a hidden form that you pass to Application.Run(). When you decide it's time for the app to go down, close that hidden form.

    0 讨论(0)
  • 2020-12-21 09:38

    Is it required to have 3 forms?

    One way is to create 3 panels in 1 form and just show the active panel.

    0 讨论(0)
  • 2020-12-21 09:40

    You can call Application.Run() with your "main" form, this will still allow the application to close properly when the form closes, but hide it (Visible=false) whilst you show the splash screen, or just show the splash screen on top of it.

    0 讨论(0)
  • 2020-12-21 09:40

    I keep answering my own questions...

    I posted this identical issue on the MSDN forums and was told to use the ApplicationContext object instead of a new Form object as a parameter in Application.Run. I am going to try that now. For now I will leave this unanswered.

    EDIT: Well, I recant. Application context does not exist in the .NET Framework v1.1

    EDIT2: Actually, it seems that it does (http://msdn.microsoft.com/en-us/library/system.windows.forms.applicationcontext(VS.71).aspx), however it does not appear to exist in the Compact Framework version 1.0 SP3.

    0 讨论(0)
提交回复
热议问题