在c# winform中,怎么做类似msn好友上线提示的探出框,各位帮忙!
解决方案 »
- c# socket 程序 局域网通过代理上外网 怎么连接
- C# 数据库
- 高手门C#里面怎么判断一个字符串是否结束?
- 我下载的VS2005中文版,格式是ISO DVD版的,可是用WINISO却打不开,出现错误,怎么办?
- 高难度问题!解决之后再加!高手进来看看
- c#程序在自己机子可以运行,在其他没装过C#的机子上运行提示,程序初始化失败,怎么回师?
- 如果用C#写应用工具,会得到多少支持?现在的.net framework的装机量不会太大吧
- 无法新建项目(VB/VC#/VC)!!!总出“VC软件包不可用或未注册”是何原因?
- 日期格式的问题
- 在winform中如何显示HTML文件?只能用shdocvw.dll中的BrowserControl吗?
- (小女子第一次用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动一下就行了