日期:2014-05-18  浏览次数:21179 次

C#泡泡提示
就如电脑一插入USB时,右下角的托盘图标就会有个"泡泡提示框",就像看卡通,漫画里的说话框一样的...

那个用C Shape如何做?

我像我的程序打开后,右下角的托盘会有提示...

或是最小化时也有

------解决方案--------------------
这个,应该要用第三方控件吧。
自己写的话感觉有点麻烦
------解决方案--------------------

试试吧!
C# code

namespace WindowsApplication1
{
    partial class Form1
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            this.notifyIcon1.ShowBalloonTip();
            //if (disposing && (components != null))
            //{
            //    components.Dispose();
            //}
            //base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
            this.SuspendLayout();
            // 
            // notifyIcon1
            // 
            this.notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
            this.notifyIcon1.BalloonTipText = "服务已启动";
            this.notifyIcon1.BalloonTipTitle = "Note:";
            this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
            this.notifyIcon1.Text = "Hello Demo";
            this.notifyIcon1.Visible = true;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.MaximizeBox = false;
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.NotifyIcon notifyIcon1;
    }
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.notifyIcon1.ShowBalloonTip(2);
        }
    }
}

------解决方案--------------------
NotifyIcon.ShowBalloonTip 方法 (Int32) 

注意:此方法在 .NET Framework 2.0 版中是新增的。

在任务栏中持续显示气球提示指定的时间。 

要VS2005或以上版本才能用

------解决方案--------------------
在csdn资源下载界面搜索DotNetBar6.0 .dll 

在工具箱,右键->选择项...->选.net framwork组件选"浏览"->把dotnetbar6.0 .dll加入. 
using DevComponents.DotNetBar;
form_load写入下面的代码就可以了.

C# code

         DevComponents.DotNetBar.Balloon b = new DevComponents.DotNetBar.Balloon();
            b.Style = eBallonStyle.Alert;
            Rectangle r = Screen.GetWorkingArea(this);
            b.Location = new Point(r.Right - b.Width, r.Bottom - b.Height);
            b.AutoClose = true;
            b.AutoCloseTimeOut = 15;