C#(winform)中如何实现像MSN或QQ那样,弹出某某人刚刚登陆的提示信息框,并且点击信息框中的连接会打开相应的网站

ys_honghu 2006-10-25 05:09:05
1.winform如何实现像MSN或QQ那样,在屏幕的右下方弹出某某人刚刚登陆的提示信息框,并且点击信息框中的连接会打开相应的网站,并且信息框在一定时间内自动消失!!!
2.还有像MSN那样,点关闭按钮不会退出程序,而是在任务栏右侧显示一个该应用程序的图标,点击图标会打开应用程序的窗口。
解决其中一个问题也给分,给代码也行,给方法也行,谢谢您!!
...全文
1800 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
oolongTea 2006-10-25
  • 打赏
  • 举报
回复
mark
ys_honghu 2006-10-25
  • 打赏
  • 举报
回复
我的意思是说,只要应用程序一启动,就自动跟踪数据库服务器,只要发现有新的记录,就在屏幕右下方弹出一个小窗体,小窗体中显示的是新增的数据,点击每条新增的数据会打开相应的网页
孟子E章 2006-10-25
  • 打赏
  • 举报
回复
有个开源项目做这个的,找找吧
灰太狼 2006-10-25
  • 打赏
  • 举报
回复
我剛才在回答第二個問題時,是有前提條件的,就是你自己要定義NotifyIcon,我寫的隻是點關閉按鍵部分的代碼。
kellynt 2006-10-25
  • 打赏
  • 举报
回复
第一个问题:有现成的控件,可以实现,很多,如 dotnetbar
第二个问题:Closing事件中写代码,实现托盘图标
灰太狼 2006-10-25
  • 打赏
  • 举报
回复
第一個問題也好辦,建兩個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;
}

}
}
feiyun0112 2006-10-25
  • 打赏
  • 举报
回复
http://www.codeproject.com/cs/miscctrl/taskbarnotifier.asp

TaskbarNotifier, a skinnable MSN Messenger-like popup in C# and now in VB.NET too

2.
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
灰太狼 2006-10-25
  • 打赏
  • 举报
回复
2.
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
e.e.Cancel = true;
}

110,577

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧