模拟万象管理提示:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Clsmn {
public partial class Form1 : Form {
public Form1(string msg) {
InitializeComponent();
this.ShowMsg = msg;
}
public Form1() {
InitializeComponent();
}
private string ShowMsg;
private Point Work = new Point(SystemInformation.WorkingArea.Width - 275, SystemInformation.WorkingArea.Height);
private void lblClose_Click(object sender, EventArgs e) {
this.Close();
}
int time = 0;
private void timer1_Tick(object sender, EventArgs e) {
if(Work.Y < SystemInformation.WorkingArea.Height - this.Height) {
time++;
if(time > 300) {
timer1.Stop();
timer2.Start();
}
}
else {
this.Location = Work;
Work = new Point(Work.X, Work.Y -= 6);
this.Activate();
}
}
private void timer2_Tick(object sender, EventArgs e) {
this.Location = Work;
Work = new Point(Work.X, Work.Y += 6);
if(Work.Y > SystemInformation.WorkingArea.Height)
Application.Exit();
}
private void Form1_Load(object sender, EventArgs e) {
if(!string.IsNullOrEmpty(ShowMsg))
this.lblMsg.Text = ShowMsg;
}
}
}
本文介绍了一个使用C#实现的模拟万象管理提示窗程序,该程序能够在屏幕中以特定方式移动并最终消失。通过定时器控制窗口的位置变化,实现了提示信息的显示效果。
1440

被折叠的 条评论
为什么被折叠?



