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);
}
}
}
}










LZ,我都看懂了…你放到编译器里面会看不懂?
我想撞墙
利用系统;使用System.Collections.Generic ;使用 ;使用System.Data ;使用System.Drawing ;使用System.Text ;使用System.Windows.Forms ;名字空间WindowsApplication1 (公共部分Form1类:表格(诠释x = 0 ;诠释为y = 0 ;公众在Form1 ( ) ( InitializeComponent ( ) ; Form.CheckForIllegalCrossThreadCalls =假; x = Screen.PrimaryScreen.Bounds 。宽度- this.Width ;为Y = Screen.PrimaryScreen.Bounds.Height ; ) / /窗体加载事件;私营无效Form1_Load (对象发送者, EventArgs五) ( this.Location =新的起点(的x , y ) ;定时器。启动( ) ; / /启用计时器; )私人无效timer1_Tick (对象发送者, EventArgs五) (为Y = Ÿ - 10 ; this.Location =新的起点(的x , y ) ;如果(是“ = Screen.PrimaryScreen.Bounds 。高度- this.Height - 30 ) ( timer1.St同( ) ; System.Threading.Thread.Sleep ( 5000 ) ; this.Close ( ) ; ) )私人无效Form1_FormClosing (对象发送者, FormClosingEventArgs五) (而(真正) (为Y = Ÿ + 10 ; this.Location =新点(的x , y ) ;如果(是“ = Screen.PrimaryScreen.Bounds.Height )破; System.Threading.Thread.Sleep ( 100 ) ; ) ) ) )