📄 jackmessageui.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;
namespace UI
{
/// <summary>
/// JackMessageUI 的摘要说明。
/// </summary>
public class JackMessageUI : System.Windows.Forms.Form
{
private string Message="";
private System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public JackMessageUI(string Message)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.Message=Message;
//
// 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.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(12, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(180, 56);
this.label1.TabIndex = 0;
//
// JackMessageUI
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(128)));
this.ClientSize = new System.Drawing.Size(208, 85);
this.Controls.Add(this.label1);
this.Name = "JackMessageUI";
this.ShowInTaskbar = false;
this.Text = "电子提醒";
this.TopMost = true;
this.Load += new System.EventHandler(this.JackMessageUI_Load);
this.ResumeLayout(false);
}
#endregion
private void JackMessageUI_Load(object sender, System.EventArgs e)
{
this.label1.Text=this.Message;
this.Top=Screen.PrimaryScreen.Bounds.Height;//设置当前窗体坐标的top
this.Left=Screen.PrimaryScreen.WorkingArea.Width-this.Width;//设置当前窗体坐标的left
Thread th=new Thread(new ThreadStart(ChangeThisPoint));//绑定改变坐标的方法
th.IsBackground=true;//设置为后台线程
th.Start();
}
/// <summary>
/// 改变当前窗体坐标的方法
/// </summary>
public void ChangeThisPoint()
{
Thread.Sleep(500);
while(this.Bottom>Screen.PrimaryScreen.WorkingArea.Height)//从无到有
{
this.Top--;
Thread.Sleep(10);
}
//****************如果你需要让它停留一端时间直接关闭请加入以下两行代码(请自己调整停留时间)*******************
// Thread.Sleep(6000);
// this.Close();
//*******************如果你想让它停留一段时间后自动向下移动到看不见再关闭请加入以下代码************************
// Thread.Sleep(6000);
// while(this.Top<Screen.PrimaryScreen.Bounds.Height)//从有到无
// {
// this.Top++;
// Thread.Sleep(10);
// }
// this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -