Deniz Gülkan
unread,Oct 8, 2011, 6:42:17 AM10/8/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to A1OB
Picturebox'u çalışma sayfamızda hareket nasıl ettiririz? Bu dersimizde
bunu öğrenelim.
İlk olarak çalışma sayfamıza bir adet Picturebox, bir adet label, ve
bir adet timer ekliyoruz.
Pictureboxımızın properties kısmından size 50;50 locationını 0;0
ayarlayıp arkaplanına bir renk veriyoruz.
Ve aşağıdaki Kodları sayfamıza yapıştırıyoruz.
private void Form1_Load(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (pictureBox1.Top == 0)
{
pictureBox1.Left += 10;
label1.Text = "Left:" + pictureBox1.Left.ToString()
+"n Right:" + pictureBox1.Right.ToString() + "n Top:" +
pictureBox1.Top.ToString() + "n Bottom" +
pictureBox1.Bottom.ToString();
}
if (pictureBox1.Left == 400)
{
pictureBox1.Top += 10;
label1.Text = "Left:" + pictureBox1.Left.ToString() +
"n Right:" + pictureBox1.Right.ToString() + "n Top:" +
pictureBox1.Top.ToString() + "n Bottom" +
pictureBox1.Bottom.ToString();
}
if (pictureBox1.Top == 400)
{
pictureBox1.Left -= 10;
label1.Text = "Left:" + pictureBox1.Left.ToString() +
"n Right:" + pictureBox1.Right.ToString() + "n Top:" +
pictureBox1.Top.ToString() + "n Bottom" +
pictureBox1.Bottom.ToString();
}
if (pictureBox1.Left == 0)
{
pictureBox1.Top -= 10;
label1.Text = "Left:" + pictureBox1.Left.ToString() +
"n Right:" + pictureBox1.Right.ToString() + "n Top:" +
pictureBox1.Top.ToString() + "n Bottom" +
pictureBox1.Bottom.ToString();
}