C#代码翻译..!
这段代码对我很重要,我们就快交项目了.! 我想完成这个功能,! 请帮我解释一下, 别且写上注释,! 先谢谢各位了.1! 以下是一个右下角窗体 ,缓慢移动上升或下降的代码:
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
int x = 0;
int y = 0;
public Form1()
{
InitializeComponent();
Form.CheckForIllegalCrossThreadCalls = false;
x = Screen.PrimaryScreen.Bounds.Width - this.Width;
y = Screen.PrimaryScreen.Bounds.Height;
}
//窗体加载事件;
private void Form1_Load(object sender, EventArgs e)
{
this.Location = new Point(x, y);
timer1.Start(); //启用计时器;
}
private void timer1_Tick(object sender, EventArgs e)
{
y = y - 10;
this.Location = new Point(x, y);
if (y <= Screen.PrimaryScreen.Bounds.Height - this.Height - 30)
{
timer1.Stop();
System.Threading.Thread.Sleep(5000);
this.Close();
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
while (true)
{
y = y + 10;
this.Location = new Point(x, y);
if (y >= Screen.PrimaryScreen.Bounds.Height)
break;
System.Threading.Thread.Sleep(100);
}
}
}
}