创建一个弹出气球像Windows Messenger或AVG [英] Creating a Popup Balloon like Windows Messenger or AVG

查看:243
本文介绍了创建一个弹出气球像Windows Messenger或AVG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个弹出气球一样,你会从Windows Messenger或AVG或诺顿或任何人看?

How can I create a Popup balloon like you would see from Windows Messenger or AVG or Norton or whomever?

我想让它显示的信息,然后在几秒钟后滑开。

I want it to show the information, and then slide away after a few seconds.

编辑:它需要阻止像Form.ShowDialog(),因为显示的通知后,在程序退出

It needs to be blocking like Form.ShowDialog() because the program exits after displaying the notification

推荐答案

您可以使用NotifyIcon控件这是对.NET 2.0 System.Windows.Forms的一部分。这可以让你把一个图标在系统托盘应用程序。然后,您可以调用该ShowBalloonTip(INT超时)方法。请务必然而,首先设置在NotifyIcon的为它工作的文字和图标属性。小code样品:<​​/ P>

You can use the notifyIcon control that's part of .NET 2.0 System.Windows.Forms. That allows you to place an icon for your application in the System Tray. Then, you can call the ShowBalloonTip(int timeOut) method on that. Be sure however to first set the text, and icon properties on the notifyIcon for it to work. Small code sample:

private void button1_Click(object sender, EventArgs e)
        {
            this.notifyIcon1.BalloonTipText = "Whatever";
            this.notifyIcon1.BalloonTipTitle = "Title";
            this.notifyIcon1.Icon = new Icon("icon.ico");
            this.notifyIcon1.Visible = true;
            this.notifyIcon1.ShowBalloonTip(3);
        }

编辑:好了,NotifyIcon的不会为你工作。然后我的第二个建议是要创建自己的控制这一点。事实上,我会用一种形式。一个简单的表格,没有国界,也没有控制箱,只是有一个计时器运行,所以你可以设置不透明度为淡入/淡出。然后,你可以很容易地使用矩形Screen.PrimaryScreen.WorkingArea屏幕的右下角。然后,只需在该位置显示您的表单。

Ok, so notifyIcon won't work for you. My second suggestion would then be to create your own control for this. Actually, I would use a form. A simple form, with no borders, and no control box and just have a timer running so you can set the Opacity for fade in/out. Then, you can easily get the bottom right of the screen using the Rectangle Screen.PrimaryScreen.WorkingArea. Then just show your form at that position.

这篇关于创建一个弹出气球像Windows Messenger或AVG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆