C#屏幕壁纸
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 WindowsFormsApp1
{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void Form1_Load(object sender, EventArgs e){this.BackColor = Color.Cyan;label1.ForeColor = Color.Red;label1.Font = new Font("",24);label1.Left = this.Width / 2 - label1.Width / 2;this.FormBorderStyle = FormBorderStyle.None;this.Location = new Point(0,0);}private void timer1_Tick(object sender, EventArgs e){this.Left = this.Left + 3;this.Top = this.Top + 3;if (this.Top + this.Height >= Screen.PrimaryScreen.WorkingArea.Height){timer1.Stop();timer2.Start();}if (this.Left + this.Width >= Screen.PrimaryScreen.Bounds.Width){timer1.Stop();timer4.Start();}}private void timer2_Tick(object sender, EventArgs e){this.Left = this.Left + 3;this.Top = this.Top - 3;if (this.Left + this.Width >= Screen.PrimaryScreen.Bounds.Width){timer2.Stop();timer3.Start();}if (this.Top <= 0){timer2.Stop();timer1.Start();}}private void timer3_Tick(object sender, EventArgs e){this.Left = this.Left - 3;this.Top = this.Top - 3;if (this.Left <= 0){timer3.Stop();timer4.Start();}if (this.Top <= 0){timer3.Stop();timer4.Start();}}private void timer4_Tick(object sender, EventArgs e){this.Left = this.Left - 3;this.Top = this.Top + 3;if (this.Left <= 0){timer4.Stop();timer1.Start();}if (this.Top + this.Height >= Screen.PrimaryScreen.WorkingArea.Height){timer4.Stop();timer3.Start();}}}
}
运行结果