检测移动设备最小化
Windows Mobile 6.5.3 专业版
.NET框架3.5
C# Visual Studio 2008
Windows 7 Professional SP1
当应用程序在 MC75A 上运行时,“标题栏”右上角会出现一个带有 X 的小图标(如果表单的 MinimizeBox 属性设置为 false,则为“确定”)。我被告知按下该图标时该应用程序必须终止。我想建立一个事件处理程序来触发新闻事件、执行总结并终止应用程序(Application.Exit)。
我不知道如何检测图标按下。此外,对于实现关闭的最佳方法有什么建议吗?
TIA
Windows Mobile 6.5.3 Professional
.NET Framework 3.5
C#
Visual Studio 2008
Windows 7 Professional SP1
When the app runs on an MC75A, a small icon with an X (or OK if the form's MinimizeBox property is set false) is present at the top right in the "title bar". I have been advised that the app must terminate when that icon is pressed. I would like to establish an event handler to trigger on the press event, perform wrapup, and terminate the app (Application.Exit).
I do not know how to detect the icon press. Further, are there any suggestions on the best method to achieve shutdown?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(X) 是一个最小值。它应该最小化,而不是退出应用程序。遵循预期的平台行为。单击(确定)将关闭表单,将控制权返回给显示该表单的人员。如果调用者是 Application.Run(),那么应用程序将正常终止,这是您应该努力实现的模式。关闭子表单或对话框也不是预期的行为。
如果您确实必须关闭应用程序,则只需将其添加到表单代码中即可:
同样,我仍然不同意这一点。一般来说,如果您的应用手动调用
Application.Exit()
,则存在设计问题。The (X) is a minimize. It should minimize, not exit the app. Follow expected platform behavior. Clicking (ok) will close the Form, returning control back to whomever showed the Form. If the caller was Application.Run(), then the app will terminate normally and this is the pattern you should be striving to achieve. Closing a sub-form or dialog is again not expected behavior.
If you really must close the app, then just add this to the Form code:
Again, I'd still disagree with this. As a general rule, if your app is manually calling
Application.Exit()
, you have a design problem.