怎么做 像QQ 和51 那样的上线提醒的 右边冒出来的小窗口
那个冒出来的小窗口 该怎么写代码....
最好有点 代码提示
谢谢了
那个冒出来的小窗口 该怎么写代码....
最好有点 代码提示
谢谢了
解决方案 »
- 怎么在datagridview和数据绑定后,在中间插入行,删除行
- 本地测试没有问题,在客户电脑上出了 See the end of this message for details on invoking
- c# 关于bitmap传输问题
- 类名加上中括号作为返回值什么意思
- 希望提供点思路 点击Button的问题
- 求助验证的问题。。内详。
- 注册会员时,如果实现用户名自动检测是否可用..
- 请问网站程序在我的机子上可以运行,当上传到服务器上,总是运行一会儿就不能运行了,提示:找不到文件或程序集名称“×××”,或找不到
- 如何从XML文件中读出来,然后update到SQL表中??(表有主键)
- 初始化前为什么要加@?
- C# 中如何用API实现如记事本中的查找和替换功能
- 关于datagridview里checkbox列事件的一个很严重的问题.
/// <summary>
/// 警告闪烁对话框
/// </summary>
public partial class WarningInfoPromptDlg : Form
{
/// <summary>
/// API函数,闪烁窗口用
/// </summary>
/// <param name="handle">
/// 闪烁的控件句柄
/// </param>
/// <param name="bInvert">
/// 是否闪烁
/// </param>
/// <returns></returns>
[System.Runtime.InteropServices.DllImportAttribute("user32.dll")]
public static extern bool FlashWindow(IntPtr handle, bool bInvert);
//
private int heightMax;
/// <summary>
/// 高度最大值
/// </summary>
public int HeightMax
{
get { return heightMax; }
set { heightMax = value; }
}
private int widthMax;
/// <summary>
/// 宽度最大值
/// </summary>
public int WidthMax
{
get { return widthMax; }
set { widthMax = value; }
}
private int equipNo = 0;
/// <summary>
/// 装置号
/// </summary>
public int EquipNo
{
get { return equipNo; }
set { equipNo = value; }
}
private DateTime dt = new DateTime();
/// <summary>
/// 报警发生时间
/// </summary>
public DateTime Dt
{
get { return dt; }
set { dt = value; }
}
private string message = "";
/// <summary>
/// 报警信息
/// </summary>
public string Message
{
get { return message; }
set { message = value; }
}
private bool useAlertSound = true;
/// <summary>
/// 是否使用报警音
/// </summary>
public bool UseAlertSound
{
get { return useAlertSound; }
set { useAlertSound = value; }
}
public WarningInfoPromptDlg()
{
InitializeComponent();
} private void WarningInfoPromptDlg_Load(object sender, EventArgs e)
{
Screen[] screens = Screen.AllScreens;
Screen screen = screens[0];//获取屏幕变量
this.Location = new Point(screen.WorkingArea.Width - widthMax - 5, screen.WorkingArea.Height - 34);//WorkingArea为Windows桌面的工作区
if (useAlertSound)
{
timer3.Enabled = true;
}
}
/// <summary>
/// 滚动显示窗口
/// </summary>
public void ScrollShow()
{
this.Width = widthMax;
this.Height = 0;
labelEquipNo.Text = string.Format("{0:D}号装置", equipNo);
labelTime.Text = dt.ToString("T");
richTextBox1.Text = message;
this.Show();
this.timer1.Enabled = true;
}
//滚动上升窗口
private void ScrollUp()
{
if (this.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.timer2.Enabled = false;
this.Close();
}
} private void timer1_Tick(object sender, EventArgs e)
{
ScrollUp();
} private void timer2_Tick(object sender, EventArgs e)
{
//ScrollDown();
FlashWindow(this.Handle, true);
}
//报警声音
private void timer3_Tick(object sender, EventArgs e)
{
Console.Beep(0X23F, 500);
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication9
{
public partial class Form1 : Form
{
private int heightMax = 0; public Form1()
{
InitializeComponent();
this.Load += new EventHandler(FrmMessage_Load);
this.timer1.Tick += new EventHandler(timer1_Tick);
} private void FrmMessage_Load(object sender, System.EventArgs e)
{
ScrollShow(200, 200);
}
public void ScrollShow(int height,int width)
{
Screen screen = Screen.AllScreens[0];//获取屏幕变量
this.Location = new Point(screen.WorkingArea.Width - width, screen.WorkingArea.Height - 34);
this.heightMax = height;
this.Width = width;
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 timer1_Tick(object sender, System.EventArgs e)
{
ScrollUp();
}
}
}
{
Thread receivex = new Thread(new ThreadStart(this.showwiindow));
receivex.Start();
Thread.Sleep(6000);
}
delegate void showwiindowHandler();
private void showwiindow()
{
if (this.InvokeRequired)
{
showwiindowHandler si = new showwiindowHandler(this.showwiindow);
this.BeginInvoke(si, new object[0]);
return;
}
Message form=new Message();
form.HeightMax=120;
form.WidthMax=148;
form.ScrollShow();
}参考
参考
其实就是一个FORM ,开始显示在任务栏下,触发后,一个timer 不停将这个FORM 向上移动。DOTNETBAR 中有写好的控件可以使用~~~