根据设置值运行表单 [英] Run a form depending on setting value

查看:64
本文介绍了根据设置值运行表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bool应用程序设置和2个表单,第一个是我要显示的介绍表单,并将设置的值更改为false然后关闭自身并显示其他表单。当我启动应用程序的新实例时,它应该绕过引入表单并直接转到第二个,因为它已经查看了现在为false的设置,因此它不会再次加载它。我该怎么做?我希望应用程序在没有打开表单的情况下运行并检查设置。如果为true,则显示介绍表单并将设置设置为false。如果是假则应该只显示第二种形式。它需要进入应用程序启动的'Program.cs'。写这个很匆忙所以希望它有意义。感谢您的帮助。

I have a bool application setting and 2 forms, the first is a introduction form that I want to show and change the value of the setting to false then close itself and show the other form. When I launch a new instance of the application it should bypass the introduction form and go straight to the second one because it has looked at the setting which is now false so it will not load it again. How would I do this? I want the application to run with no forms open and check the setting. If it is true then the introduction form shows and sets the setting to false. If it is false is should show the second form only. It would need to go in 'Program.cs' where the application starts. Wrote this is a hurry so hope it makes sense. Thanks for any help.

推荐答案

是的,这是一个众所周知的技术。但是,我会建议另一种选择:只有一个表单有两组不同的控件,比如说两个面板有不同的控件组。在第一步,显示一个面板,隐藏另一个面板。第二步,交换面板的可见性。没有两个应用程序运行,没有关闭表单,没有隐藏的意外。



-SA
Yes, this is a well-know technique. However, I would advise another option: have only one form with two different set of controls, say, two panels with different set of controls. On first step, show one panel, have another one hidden. On second step, swap the visibility of panel. No two application runs, no closing of the form, no hidden surprises.

—SA


这篇关于根据设置值运行表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆