如何制作重启按钮 [英] how to make a restart button

查看:132
本文介绍了如何制作重启按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在编码方面特别是新手,尤其是在GUI应用程序上,我已经开发了一个游戏,并且无法使游戏的重新启动按钮正常工作,我使用了Application.Restart方法bt来重新启动整个应用程序,我不能指定我要在哪里执行代码吗?
或其他替代方法..

hello, i am quite new on coding, especially on GUI applications, i have developed a game and i cant make the restart button of the game work correctly, i have used the Application.Restart method bt it restarts the whole application, cant i specify where i want the code to execute?
or other alternatives..

推荐答案

Application.Restart可以正常工作.

它总是终止Applicaion的当前实例并启动新实例. - Application.Restart方法


您应该为游戏的重新启动"功能编写自己的自定义代码.您可以编写方法-"RestartGame",其中清除/处置所有当前使用的对象,重新初始化新游戏所需的所有对象/变量.
Application.Restart is working as it should.

It always terminates the current instance of the Applicaion and starts the new instance. - Application.Restart Method


You should write your own custom code for "Restart" feature of your Game. You may write a Method - "RestartGame" in which clear/dispose all the current used objects, Reinitialize all the objects/variables required for New-Game.


您做错了.

我知道,我的答案可能看起来含糊不清,甚至有些晦涩,但问题的质量决定了答案的质量.提示-我们需要更多信息.
You''re doing it wrong.

I know, my answer might seem vague, or even obtuse, but the quality of the question dictates the quality of the answer. Hint - we need more info.


在任何应用程序中都应具有入口点,例如C# Windows应用程序中的Main 方法.在该方法中,我们可以放置应用程序启动代码,例如,调用OpenCalculator()方法来启动计算器.因此,如果您重新启动button,请从重新启动button 调用OpenCalculator 方法来重新启动计算器.

:)
In any application should have the entry point for example, Main method in C# windows application. In that method we could put application start up code, for example, call OpenCalculator() method to start the calculator. So if you a restart button, from the restart button call the OpenCalculator method to restart the Calculator.

:)


这篇关于如何制作重启按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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