在c# winform中,怎么做类似msn好友上线提示的探出框 在c# winform中,怎么做类似msn好友上线提示的探出框,各位帮忙! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.microsoft.com/china/community/Column/64.mspx codeproject.com上面很多这样的东西 using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;namespace Calendar{ /// <summary> /// clew 的摘要说明。 /// </summary> public class clew : System.Windows.Forms.Form { private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer2; private System.Windows.Forms.Timer timer3; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.ComponentModel.IContainer components; public clew() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer2 = new System.Windows.Forms.Timer(this.components); this.timer3 = new System.Windows.Forms.Timer(this.components); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // timer1 // this.timer1.Interval = 10; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // timer2 // this.timer2.Interval = 10; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // // timer3 // this.timer3.Interval = 10; this.timer3.Tick += new System.EventHandler(this.timer3_Tick); // // label1 // this.label1.Location = new System.Drawing.Point(24, 40); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(152, 96); this.label1.TabIndex = 0; // // label2 // this.label2.Location = new System.Drawing.Point(0, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(192, 24); this.label2.TabIndex = 1; // // clew // this.AutoScaleBaseSize = new System.Drawing.Size(7, 15); this.BackColor = System.Drawing.SystemColors.InactiveCaption; this.ClientSize = new System.Drawing.Size(194, 150); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Cursor = System.Windows.Forms.Cursors.Hand; this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "clew"; this.ShowInTaskbar = false; this.Text = "提示……"; this.TopMost = true; this.Load += new System.EventHandler(this.clew_Load); this.ResumeLayout(false); } #endregion private string info;//设置提示窗体的内容; public string Info { set { info=value; } get { return info; } } private int heightMax, widthMax;//设置窗体显示的大小的属性 public int HeightMax { set { heightMax = value; } get { return heightMax; } } public int WidthMax { set { widthMax = value; } get { return widthMax; } } public void ScrollShow() { this.Width = widthMax; this.Height = 0; this.Show(); this.timer1.Enabled = true; } public int StayTime = 5000;//窗体的停留时间 //窗体的滚出与滚入方法 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; this.timer2.Enabled = true; } } private void ScrollDown() { if(Height > 3) { this.Height -= 3; this.Location = new Point(this.Location.X, this.Location.Y + 3); } else { this.timer3.Enabled = false; this.Close(); } } private void clew_Load(object sender, System.EventArgs e) { string dNow; dNow=DateTime.Now.ToShortTimeString().ToString(); this.label2.Text="现在时刻是:"+dNow; this.label1.Text=info; Screen[] screens = Screen.AllScreens; Screen screen = screens[0];//获取屏幕变量 this.Location = new Point(screen.WorkingArea.Width - widthMax - 20, screen.WorkingArea.Height - 34);//WorkingArea为Windows桌面的工作区 this.timer2.Interval = StayTime; } private void timer1_Tick(object sender, System.EventArgs e) { ScrollUp(); } private void timer2_Tick(object sender, System.EventArgs e) { timer2.Enabled = false; timer3.Enabled = true; } private void timer3_Tick(object sender, System.EventArgs e) { ScrollDown(); } }} new一个窗口不要标题栏设置一下颜色风格用Timer动一下就行了 codeproject上有很好用的,借鉴一下吧 小问题combobox 将Excel的数据插入到access数据库 一道题不会写 求解 在vs2003中自定义安装问题,请高手指教 一个最基本的问题求教——送分啊! 准备做WINCE开发,想转入C#,不知C#和VB.NET的区别 MSMQ中如何删除一定时间段的信息? 在ASPX 文件中怎样为动态建立的控件添加事件 关于继承窗体的布局 C#调用C++函数指针问题 (小女子第一次用C#遇到难题,请教高人)怎样用c#调用智能ABC输入法??? 求C#删除Excel里的Sheet正解
上面很多这样的东西
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace Calendar
{
/// <summary>
/// clew 的摘要说明。
/// </summary>
public class clew : System.Windows.Forms.Form
{
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Timer timer3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.ComponentModel.IContainer components; public clew()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// timer1
//
this.timer1.Interval = 10;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timer2
//
this.timer2.Interval = 10;
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// timer3
//
this.timer3.Interval = 10;
this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 96);
this.label1.TabIndex = 0;
//
// label2
//
this.label2.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(192, 24);
this.label2.TabIndex = 1;
//
// clew
//
this.AutoScaleBaseSize = new System.Drawing.Size(7, 15);
this.BackColor = System.Drawing.SystemColors.InactiveCaption;
this.ClientSize = new System.Drawing.Size(194, 150);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "clew";
this.ShowInTaskbar = false;
this.Text = "提示……";
this.TopMost = true;
this.Load += new System.EventHandler(this.clew_Load);
this.ResumeLayout(false); }
#endregion
private string info;//设置提示窗体的内容;
public string Info
{
set
{
info=value;
}
get
{
return info;
}
}
private int heightMax, widthMax;//设置窗体显示的大小的属性
public int HeightMax
{
set
{
heightMax = value;
}
get
{
return heightMax;
}
} public int WidthMax
{
set
{
widthMax = value;
}
get
{
return widthMax;
}
}
public void ScrollShow()
{
this.Width = widthMax;
this.Height = 0;
this.Show();
this.timer1.Enabled = true;
}
public int StayTime = 5000;//窗体的停留时间
//窗体的滚出与滚入方法
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;
this.timer2.Enabled = true;
}
} private void ScrollDown()
{
if(Height > 3)
{
this.Height -= 3;
this.Location = new Point(this.Location.X, this.Location.Y + 3);
}
else
{
this.timer3.Enabled = false;
this.Close();
}
} private void clew_Load(object sender, System.EventArgs e)
{
string dNow;
dNow=DateTime.Now.ToShortTimeString().ToString();
this.label2.Text="现在时刻是:"+dNow;
this.label1.Text=info;
Screen[] screens = Screen.AllScreens;
Screen screen = screens[0];//获取屏幕变量
this.Location = new Point(screen.WorkingArea.Width - widthMax - 20, screen.WorkingArea.Height - 34);//WorkingArea为Windows桌面的工作区
this.timer2.Interval = StayTime;
} private void timer1_Tick(object sender, System.EventArgs e)
{
ScrollUp(); } private void timer2_Tick(object sender, System.EventArgs e)
{
timer2.Enabled = false;
timer3.Enabled = true; } private void timer3_Tick(object sender, System.EventArgs e)
{
ScrollDown(); }
}
}
不要标题栏
设置一下颜色风格
用Timer动一下就行了