下班结贴,散分using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace ActiveForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        int x = 5;
        int y = 5;        private void Form1_Load(object sender, EventArgs e)
        {
            Init();
            timer1.Start();
        }        private void timer1_Tick(object sender, EventArgs e)
        {
            this.Left += x;
            this.Top += y;
            if (this.Left < 0 || this.Left > Screen.PrimaryScreen.WorkingArea.Width - this.Width)
            {
                x = -x;
            }
            if (this.Top < 0 || this.Top > Screen.PrimaryScreen.WorkingArea.Height - this.Height)
            {
                y = -y;
            }
        }        private void Init()
        {
            timer1.Interval = 1;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        }
    }
}