设计等待按钮按下的功能. [英] Designing a function that waits for a button press.
本文介绍了设计等待按钮按下的功能.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我们说我想填写一份期权表格.例如,包含它的对象称为选项".我希望能够在选项"中调用一个函数以使其运行,等待用户在表单中输入值并按确定",然后然后返回一个值.如何在Options类中设计一个函数,该函数在返回值之前等待按钮按下?像这样:
Let''s say I wanted to make an options form. The object that contains it is called Options, for example. I want to be able to call a function in Options that would make it run, wait for the user to input values in the form and press okay, and then return a value. How could I design a function inside the Options class that waits for a button press before returning a value? Like this:
public partial class Options : Form
{
public SomeClass Run(SomeClass defualts)
{
//Do some set up stuff like setting up the options with
//their default values or whatever I''d like
//Wait for the user to press okay <-- Need help here
//then do this:
return SomeVariable;
}
}
谢谢:-D
Thanks :-D
推荐答案
听起来像是需要模态弹出窗口. Google至少会为您提供一百万个示例.
Sounds like you need a modal popup window. Google will give you at least a million examples.
这篇关于设计等待按钮按下的功能.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文