本文介绍了通知从一无所有泡在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在没有图形可言,并做了一堆网络运行C#应用程序,我需要能够显示通知气泡(放在第一位,几秒钟)对某些事件的图标托盘附近。

in a C# application that has no graphics at all, and does a bunch of network operations, I need to be able to show notification bubbles (on top of everything, for a few seconds) near the icon tray on certain events.

我一直在找这个:

但没有成功。它的问题在于,设计有窗户将不会展示在asynchroneous事件。看来,我需要一个主要形式先上,我增加了它的工作代表,我已经没有必要。

But with no success. The problem with it is that the windows designed there won't show on asynchroneous events. It seems that I need a main form first on which I add delegates for it to work, which I have no need for.

我到目前为止看到要求我在我的申请表格所有的选项,但是这不会发生。它是不可能再有这些泡沫?有任何想法吗 ?必须有加在托盘弹出消息inconditionally并没有GUI吧?

All options I've seen so far require me to have a form in my application, but that won't happen. Is it impossible then to have these bubbles ? Any ideas ? There must be a way to add an icon in the tray popping messages inconditionally and without GUI right ?

推荐答案

从的系统托盘图标和的气球提示

Taken from Systray icon for Console application and Creating balloon tooltip in C#

添加一个引用到两个System.Windows.Forms的和System.Drawing中。

Add a reference to both System.Windows.Forms and System.Drawing.

更新

using System.Windows.Forms;
using System.Drawing;
...

private void Form1_Load(object sender, EventArgs e)
{
    var item = new NotifyIcon(this.components);
    item.Visible = true;
    item.Icon = System.Drawing.SystemIcons.Information;
    item.ShowBalloonTip(3000, "Balloon title", "Balloon text", ToolTipIcon.Info);
}



此外,它可以是弹出式窗口的

这篇关于通知从一无所有泡在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:01