1.winform如何实现像MSN或QQ那样,在屏幕的右下方弹出某某人刚刚登陆的提示信息框,并且点击信息框中的连接会打开相应的网站,并且信息框在一定时间内自动消失!!!
    2.还有像MSN那样,点关闭按钮不会退出程序,而是在任务栏右侧显示一个该应用程序的图标,点击图标会打开应用程序的窗口。
    解决其中一个问题也给分,给代码也行,给方法也行,谢谢您!!

解决方案 »

  1.   

    2.
    private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
       this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
       e.e.Cancel = true;
    }
      

  2.   

    http://www.codeproject.com/cs/miscctrl/taskbarnotifier.aspTaskbarNotifier, a skinnable MSN Messenger-like popup in C# and now in VB.NET too2. 
    protected override void WndProc(ref   Message m)
            {
                const int WM_SYSCOMMAND = 0x0112;
                const int SC_CLOSE = 0xF060;
                const int SC_MINIMIZE = 0xF020;            if (m.Msg == WM_SYSCOMMAND && ((int)m.WParam == SC_MINIMIZE || (int)m.WParam == SC_CLOSE))
                {
                    //最小化到系统栏 
                    this.Hide();
                    return;
                }
                base.WndProc(ref   m);
            }任务栏右侧显示一个该应用程序的图标
    用NotifyIcon控件
      
    *****************************************************************************
    欢迎使用CSDN论坛阅读器 : CSDN Reader(附全部源代码) 
    http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
      

  3.   

    第一個問題也好辦,建兩個form。
    form1放一個button,裡面寫入
    private void Send_Click(object sender, System.EventArgs e)
    {
    Form2 temp = new Form2();
    temp.HeightMax=134;
    temp.WidthMax=150;
    temp.ScrollShow();
    }
    form2代碼如下;
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;namespace relax
    {
    /// <summary>
    /// Form2 的摘要描述。
    /// </summary>
    public class Form2 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Timer timer1;
    private System.Windows.Forms.Timer timer2; private string information;
    private int heightMax,widthMax;
    private System.Windows.Forms.Label message; public int HeightMax
    {
    set{ heightMax=value;}
    get{ return heightMax;}
    } public int WidthMax
    {
    set{ widthMax=value;}
    get{ return widthMax;}
    } public void ScrollShow()
    {
    message.Text = "一小時了,該休息了!";
    this.Show();
    this.Width=widthMax;
    this.Height=0;
    this.timer1.Enabled=true;
    } private void ScrollUp()
    {
    if(Height < heightMax)
    {
    this.Height += 3;
    this.Location = new Point( this.Location.X, this.Location.Y-3 );
    }
    else
    {
    this.timer1.Enabled=false;
    }
    } private void ScrollDown()
    {
    if(Height > 3 )
    {
    this.Height -= 3;
    this.Location = new Point(this.Location.X, this.Location.Y+3);

    }
    else
    {
    this.timer2.Enabled=false;
    this.Dispose();
    }
    } private System.ComponentModel.IContainer components; public Form2()
    {
    //
    // Windows Form 設計工具支援的必要項
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 呼叫之後加入任何建構函式程式碼
    //
    } /// <summary>
    /// 清除任何使用中的資源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows Form 設計工具產生的程式碼
    /// <summary>
    /// 此為設計工具支援所必須的方法 - 請勿使用程式碼編輯器修改
    /// 這個方法的內容。
    /// </summary>
    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    this.button1 = new System.Windows.Forms.Button();
    this.message = new System.Windows.Forms.Label();
    this.timer1 = new System.Windows.Forms.Timer(this.components);
    this.timer2 = new System.Windows.Forms.Timer(this.components);
    this.SuspendLayout();
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(136, 0);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(16, 16);
    this.button1.TabIndex = 0;
    this.button1.Text = "x";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // message
    // 
    this.message.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(255)), ((System.Byte)(192)));
    this.message.Location = new System.Drawing.Point(16, 16);
    this.message.Name = "message";
    this.message.Size = new System.Drawing.Size(120, 104);
    this.message.TabIndex = 1;
    this.message.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    // 
    // timer1
    // 
    this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
    // 
    // timer2
    // 
    this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
    // 
    // Form2
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
    this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(128)));
    this.ClientSize = new System.Drawing.Size(152, 136);
    this.Controls.Add(this.message);
    this.Controls.Add(this.button1);
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    this.Name = "Form2";
    this.ShowInTaskbar = false;
    this.Text = "Form2";
    this.TopMost = true;
    this.Load += new System.EventHandler(this.Form2_Load);
    this.ResumeLayout(false); }
    #endregion private void Form2_Load( object sender, System.EventArgs e )
    {
    Screen[] screens=Screen.AllScreens;
    Screen screen=screens[0];
    this.Location = new Point(screen.WorkingArea.Width-widthMax, screen.WorkingArea.Height);
    } private void timer1_Tick( object sender, System.EventArgs e )
    {
    ScrollUp();
    } private void timer2_Tick( object sender, System.EventArgs e )
    {
    ScrollDown();
    } private void button1_Click( object sender, System.EventArgs e )
    {
    timer1.Enabled=false;
    timer2.Enabled=true;
    } }
    }
      

  4.   

    第一个问题:有现成的控件,可以实现,很多,如 dotnetbar
    第二个问题:Closing事件中写代码,实现托盘图标
      

  5.   

    我剛才在回答第二個問題時,是有前提條件的,就是你自己要定義NotifyIcon,我寫的隻是點關閉按鍵部分的代碼。