How to create rich tooltips and rich balloons in notification area

那年仲夏 提交于 2019-12-03 02:54:54

You have to use the Win32 Function Shell_NotifyIcon. You can set the dwInfoFlags member of the NOTIFYICONDATA structure to NIIF_USER in order to use a custom icon for the balloon tooltip.

On Windows XP Service Pack 2 and later you can use the hIcon member to specify a custom icon.

On Windows Vista and later the NOTIFYICONDATA structure contains the addiional member hBalloonIcon. You can use this member to specify a custom icon if you have set the cbSize member to the correct size of the extended NOTIFYICONDATA structure.

Check this out:

http://www.codeproject.com/KB/WPF/WPF_TaskbarNotifier.aspx

or

www.codeproject.com/KB/WPF/wpf_notifyicon.aspx

Other option is to Make your own notification form balloon, then you will have notification with flowers background and pink borders :) BTW: that can have some functionality in it too.

As in this example:

http://i.stack.imgur.com/QtA0Y.jpg << Image Example

Create a form as you like, Region, Controls, Etc :) and code something like:

void notifyIcon_MouseMove(object sender, MouseEventArgs e)
    {
        if (!this.Visible)
        {
            ShowPopup();
        }
    }

    Timer t = new Timer();
    private void ShowPopup()
    {
        Rectangle rect = Screen.GetWorkingArea(new Point(Screen.PrimaryScreen.Bounds.Right, Screen.PrimaryScreen.Bounds.Bottom));
        this.Top = rect.Bottom - this.Height;
        this.Left = rect.Right - this.Width;
        this.Visible = true;

        t.Interval = 4000;
        t.Tick += new EventHandler(t_Tick);
        t.Start();
    }

    void t_Tick(object sender, EventArgs e)
    {
        t.Stop();
        Visible = false;
    }

    private void Form1_Click(object sender, EventArgs e)
    {
        this.Visible = false;
    }

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        notifyIcon.Visible = false;
        notifyIcon.Dispose();
    }

BTW they all look kinda same, with different Icon size, and the First one could fit to the right, while all other are aligned to left... minor shade changes Etc. :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!