using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _02气泡屏保__续集
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
Label lb = new Label();
Timer time1 = new Timer();
Timer time2 = new Timer();
Timer time3 = new Timer();
Timer time4 = new Timer();
private void Form2_Load(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
this.FormBorderStyle = FormBorderStyle.None;
lb.Text = "朱一龙";
lb.Font = new Font("楷体",40);
lb.AutoSize = true;
this.Controls.Add(lb);
time1.Interval = 10;
time1.Start();
time1.Tick += Time1_Tick;
time2.Interval = 10;
time2.Tick += Time2_Tick;
time3.Interval = 10;
time3.Tick += Time3_Tick;
time4.Interval = 10;
time4.Tick += Time4_Tick;
}
private void Time1_Tick(object sender, EventArgs e)
{
lb.Left = lb.Left + 10;
lb.Top = lb.Top + 10;
if (lb.Top+lb.Height>=Screen.PrimaryScreen.WorkingArea.Height)
{
time1.Stop();
time2.Start();
}
if (lb.Left+lb.Width>=Screen.PrimaryScreen.Bounds.Width)
{
time1.Stop();
time4.Start();
}
}
private void Time2_Tick(object sender, EventArgs e)
{
lb.Left = lb.Left + 10;
lb.Top = lb.Top - 10;
if (lb.Left+lb.Width>=Screen.PrimaryScreen.Bounds.Width)
{
time2.Stop();
time3.Start();
}
if (lb.Top<=0)
{
time2.Stop();
time1.Start();
}
}
private void Time3_Tick(object sender, EventArgs e)
{
lb.Left = lb.Left - 10;
lb.Top = lb.Top - 10;
if (lb.Top<=0)
{
time3.Stop();
time4.Start();
}
if (lb.Left<=0)
{
time3.Stop();
time2.Start();
}
}
private void Time4_Tick(object sender, EventArgs e)
{
lb.Left = lb.Left - 10;
lb.Top = lb.Top + 10;
if (lb.Left<=0)
{
time4.Stop();
time1.Start();
}
if (lb.Top+lb.Height>=Screen.PrimaryScreen.WorkingArea.Height)
{
time4.Stop();
time3.Start();
}
}
}
}