0
是否有办法来自动点击的MessageBox.Show("my message");
“OK”按钮? 我不想删除MessageBox
,因为它让我捕获屏幕截图(More Information)自动按下一个按钮或接受C#中的对话框
OR
有没有一种方法来保存Enter
键按下X
秒? (非常脏的方法,但它可以工作)。
编辑:我发现此代码为WPF
,虽然我不知道我怎么能实现它为我MessageBox
:
ButtonAutomationPeer peer = new ButtonAutomationPeer(someButton);
IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke)
as IInvokeProvider;
invokeProv.Invoke();
EDIT2:如果只有我能呼叫的按钮消息框我可以使用上面编写的代码完成任务。有谁知道如何调用该按钮?
我已经试过,但没有更迭:
var mensaje = MessageBox.Show("Hello Stack Overflow!", "Test", MessageBoxButton.OKCancel, MessageBoxImage.Exclamation);
如果消息框始终在顶部,你可以通过发送尝试“Enter”键http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send(v=vs.100 ).aspx – 2013-05-12 13:39:14
我正在WPF下工作,据我所知在那里没有这种方法。 =( – Sturm 2013-05-12 13:44:32
使用[popupkiller(http://www.codeproject.com/Articles/2772/C-Popup-Killer) – matzone 2013-05-12 13:52:37