من با پنجره فرم این کارو کردم شما بجای نام فرم نام لیبل رو وارد کن شاید که بدردت بخوره
public partial class Form1 : Form
{
int c = 5, j = 5;
bool idx = true;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{ if (this.Left > Screen.PrimaryScreen.WorkingArea.Width - this.Width && idx)
{
c = -5;
idx = false;
}
else if (this.Left < 0 && !idx)
{
c = 5;
idx = true;
}
this.Left += c;
if (this.Top > Screen.PrimaryScreen.WorkingArea.Height - this.Height && idx)
{
j = -5;
idx = false;
}
else if (this.Top < 0 && !idx)
{
j = 5;
idx = true;
}
this.Top += j;
}
توسط
abbastak
(108 امتیاز)
●2