可能会超时的不引人注目的警报通知
在我正在使用的应用程序中,如果用户将单元格中的值从正值更改为负值,并且该值应该始终为正值,则应用程序会强制使用正值。 目前,当发生这种情况时,不会向用户显示任何警报。
我想显示一些不显眼的警报,例如 Outlook 中收到新邮件时显示的警报或类似的警报,以便可以提醒用户应用程序代表她执行了某些操作。
我尝试使用 NotifyIcon 类来执行此操作。 但该类的问题似乎是它的超时没有按预期工作。 我想显示此警报不超过 2 秒,而 BallonTipText 持续时间超过 10 秒。
是否有用于此目的的 .NET 类? 如果没有,是否有其他方法可以做这样的事情?
In the application I am working with, if the user changes the value in a cell that is say positive to negative and the value is supposed to be positive at all times, the application forces the positive value. Right now, when this happens there is no alert shown to the user.
I would like to show a little unobtrusive alert, like the one that shows up when a new mail arrives in outlook, or something similar, so that the user can be alerted that the application did something on her behalf.
I tried using the NotifyIcon class to do this. But the problem with that class seems to be that the timeout on it doesn't work as expected. I want to show this alert for not more than 2s and the BallonTipText lasts for longer than 10s.
Is there a .NET class for this purpose?
If not, is there an alternate way to do something like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下使用通知图标对我来说似乎是错误的。 当向单元格中输入内容时,用户的注意力集中在该单元格上。 如果您在屏幕右下角显示通知,用户很可能会错过它,或者更糟糕的是,它会扰乱他的工作流程。
您可以考虑向用户正在编辑的单元格添加气球提示。 有点像当您尝试输入文件名中不允许的字符时,Windows 资源管理器在 Vista 和 Windows 7 上重命名文件时显示的气球提示:
Using a notification icon for this case seems wrong to me. The user's attention is, when entering something into a cell, on the cell. If you display the notification on the lower right of the screen the user is very likely to miss it, or worse, it disrupts his work flow.
You might instead consider adding a balloon tip to the cell the user is editing. Kinda like the balloon tip Windows Explorer is showing on Vista and Windows 7 on renaming a file when you try entering a character that is disallowed in file names:
我过去也遇到过这个问题。 我推测超时问题是因为操作系统固定了 10 秒的最小值和 30 秒的最大值(或类似的值)。编辑哦,这不包括用户空闲。编辑
我过去曾使用以下代码来解决此问题。
只是为了澄清
声明一个公共变量,假设名为 ballonTipActive,值为 0。
插入一个禁用的计时器控件,延迟 100 毫秒,并从 notificationicon 控件的 BalloonTipShown 创建一个事件。
然后
将可见属性设置为 false,然后设置为 true 即可消除气球。
I have had this problem in the past. I gather that the timeout problem is because the operating system fixes a minimum value of 10 seconds and a maximum value of 30 seconds (or something like that).Edit Oh and this doesn't include time that a user is idle.Edit
I have used the following code in the past to get around this.
Just to clarify
Declare a public variable, say called ballonTipActive with a value of 0.
Insert a timer control disabled with 100ms delay and create an event from BalloonTipShown from the notifyicon control.
Then
Setting the visible property to false then true gets rid of the balloon.