在vs [C#,WPF]中的messagebox.show()之类的函数中停止并继续 [英] Stop and continue in a function like the messagebox.show() in vs [C#, WPF]
问题描述
我正在尝试创建类似于MessageBox.Show()的东西,我必须按下按钮或者关闭MessageBox才能继续。不是一个好的解释者,但这会让你明白。
int a = 0;
MessageBox.Show(int a(在按下/关闭MessageBox后将设置为1));
a = 1;
我尝试过:
找不到任何可以尝试的东西。
尝试:MyFormToDisplay form = new MyFormTopDisplay();
form.Message = 你好 - 直到你关闭我才会继续;
if (form.ShowDialog()== DialogResult.OK)
{
// 确定按下
...
}
< blockquote> 谢谢这会解决它,但我也很好奇你如何在
中停止if(form.ShowDialog()== DialogResult.OK)
与ConsoleApplication中的Console.ReadLine()类似,我觉得这会对我后来的帮助很多
编辑:这在WPF上有效一个新项目,但当我在我的主项目中包含System.Windows.Forms时,我收到此错误
CS0176无法使用实例引用访问成员'HorizontalAlignment.Left' ;用类型名称来限定它
还有其他方法吗?
I'm trying to create something similar to MessageBox.Show(), where I have to press the button okay or close the MessageBox to continue. Not a good explainer but this will get you the idea.
int a = 0; MessageBox.Show("int a ( will set to 1 after pressin/closing the MessageBox)"); a = 1;
What I have tried:
Couldn't find anything to try.
Try:MyFormToDisplay form = new MyFormTopDisplay(); form.Message = "Hello - this will not continue until you close me"; if (form.ShowDialog() == DialogResult.OK) { // OK pressed ... }
Thanks this would solve it, But I'm also curious about how you made a stop inif (form.ShowDialog() == DialogResult.OK)Like similar to the Console.ReadLine() in a ConsoleApplication, I have a feeling this would help me alot later
EDIT: this worked in WPF on a new project, but when I include System.Windows.Forms in my main one, I get this error
CS0176 Member 'HorizontalAlignment.Left' cannot be accessed with an instance reference; qualify it with a type name insteadIs there an other way of doing this?
这篇关于在vs [C#,WPF]中的messagebox.show()之类的函数中停止并继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!