请问如何在c#中制作像msn的那种在屏幕又下角弹出的窗体啊? 请问如何在c#中制作像msn的那种在屏幕又下角弹出的窗体啊?想做一个特效,不知道如何解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用API函数AnimateWindow.[DllImport("user32", CharSet = CharSet.Auto)] public static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);具体用法自己找下MSDN吧。 如是Web可以用脚本的定时控制一个层的显示消失等来达到该效果如是Win则可以在一个From里用一个时间轴来进行这些控制。 private void button1_Click(object sender, System.EventArgs e){ Form2 form = new Form2(); form.HeightMax = 50;//窗体滚动的高度 form.WidthMax = 80;//窗体滚动的宽度 form.ScrollShow(); form.Opacity=0;}///////////////////////////////////////From窗体using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;namespace testmsn{ /// <summary> /// Form2 的摘要说明。 /// </summary> public class Form2 : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer2; private System.Windows.Forms.Timer timer3; private System.ComponentModel.IContainer components; public int StayTime = 5000; private int heightMax, widthMax; public int HeightMax { set { heightMax = value; } get { return heightMax; } } public int WidthMax { set { widthMax = value; } get { return widthMax; } } public Form2() { // // 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.label1 = new System.Windows.Forms.Label(); 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.SuspendLayout(); // // label1 // this.label1.ForeColor = System.Drawing.Color.Brown; this.label1.Location = new System.Drawing.Point(16, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(104, 16); this.label1.TabIndex = 0; this.label1.Text = "你好,你上线了!"; // // timer1 // this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // timer2 // this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // // timer3 // this.timer3.Tick += new System.EventHandler(this.timer3_Tick); // // Form2 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.Color.Green; this.ClientSize = new System.Drawing.Size(144, 48); this.Controls.Add(this.label1); this.ForeColor = System.Drawing.SystemColors.ActiveBorder; 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 public void ScrollShow() { this.Width = widthMax; this.Height = 0; this.Show(); this.timer1.Enabled = true; } private void ScrollUp() { if(Height < heightMax) { this.Opacity = this.Opacity+0.1; 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.Opacity = this.Opacity-0.1; this.Height -= 3; this.Location = new Point(this.Location.X, this.Location.Y + 3); } else { this.timer3.Enabled = false; this.Close(); } } 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(); } 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 - 20, screen.WorkingArea.Height - 34);//WorkingArea为Windows桌面的工作区 this.timer2.Interval = StayTime; } }} visual studio 2008 开发WinCE6.0 应用程序 关于C#Alpha图像混合问题 有谁弄过ClickOnce? 修改密码 关于实现流程分歧(类似switch)是的效率 大侠们很急!C#如何实现记住密码和自动登录 c#调用com组件的参数问题,一解决立给分 一个很复杂的东西。。。麻烦高手给解释下怎么应用了? 应该把那些信息记录进系统日志? jQuery传值 想在杭州找工作的进来看看 关于update的一个问题
[DllImport("user32", CharSet = CharSet.Auto)]
public static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
具体用法自己找下MSDN吧。
如是Win则可以在一个From里用一个时间轴来进行这些控制。
{
Form2 form = new Form2();
form.HeightMax = 50;//窗体滚动的高度
form.WidthMax = 80;//窗体滚动的宽度
form.ScrollShow();
form.Opacity=0;}
///////////////////////////////////////From窗体
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace testmsn
{
/// <summary>
/// Form2 的摘要说明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Timer timer3;
private System.ComponentModel.IContainer components; public int StayTime = 5000; private int heightMax, widthMax; public int HeightMax
{
set
{
heightMax = value;
}
get
{
return heightMax;
}
} public int WidthMax
{
set
{
widthMax = value;
}
get
{
return widthMax;
}
}
public Form2()
{
//
// 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.label1 = new System.Windows.Forms.Label();
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.SuspendLayout();
//
// label1
//
this.label1.ForeColor = System.Drawing.Color.Brown;
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 16);
this.label1.TabIndex = 0;
this.label1.Text = "你好,你上线了!";
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// timer2
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// timer3
//
this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.Green;
this.ClientSize = new System.Drawing.Size(144, 48);
this.Controls.Add(this.label1);
this.ForeColor = System.Drawing.SystemColors.ActiveBorder;
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
public void ScrollShow()
{
this.Width = widthMax;
this.Height = 0;
this.Show();
this.timer1.Enabled = true;
}
private void ScrollUp()
{
if(Height < heightMax)
{
this.Opacity = this.Opacity+0.1;
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.Opacity = this.Opacity-0.1;
this.Height -= 3;
this.Location = new Point(this.Location.X, this.Location.Y + 3);
}
else
{
this.timer3.Enabled = false;
this.Close();
}
} 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();
} 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 - 20, screen.WorkingArea.Height - 34);//WorkingArea为Windows桌面的工作区
this.timer2.Interval = StayTime; } }
}