/*----------------------------------------------------------------
// Copyright (C) 2007 liu523@QQ.COM
// 版权所有。
// 开发者:liu523@QQ.COM团队
// 文件名:ShowMessageForm.cs
// 文件功能描述:动态效果显示文本信息(起提醒作用)
//----------------------------------------------------------------*/
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace ShowMessage
{
///
/// 信息框
///
public partial class ShowMessageForm : Form
{
///
/// 当前的时间
///
private int times;
///
/// 总时间(上升时间+显示时间)
///
private int allTimes;
///
/// 开始上升前的高度
///
private int startTop;
///
/// 单位时间内信息框上升的高度
///
private int step;
public ShowMessageForm()
{
InitializeComponent();
}
///
/// 初始化各个参数
///
///
///
private void ShowMessageForm_Load(object sender, EventArgs e)
{
times = 0;
allTimes = 25+ (int)(txt_Message.Text.Length * 10 / 2.5);
Size screenSize = Screen.PrimaryScreen.Bounds.Size;
startTop=screenSize.Height -42;
step=this.Height/25;
this.Opacity = 0.00;
this.Left = screenSize.Width - this.Width;
this.Top = startTop;
this.TopMost = true;
txt_Message.ReadOnly = true;
txt_Message.Cursor = Cursors.Hand;
txt_Message.Enabled = false;
FormControlTimer.Enabled = true;
}
///
/// 时钟控制信息框上升
///
///
///
private void FormControlTimer_Tick(object sender, EventArgs e)
{
if (this.Opacity < 1.00)
{
this.Opacity += 0.04;
this.Top -= step;
}
if (++times > allTimes) this.Close();
}
///
/// 信息
///
public string Message
{
set
{
txt_Message.Text = value;
}
}
}
}