private void Form1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Left)
{
pictureBox1.Location = new Point(pictureBox1.Location.X - 1, pictureBox1.Location.Y);
}
if (e.KeyCode == Keys.Right)
{
pictureBox1.Location = new Point(pictureBox1.Location.X + 1, pictureBox1.Location.Y);
}
if (e.KeyCode == Keys.Up)
{
pictureBox1.Location = new Point(pictureBox1.Location.X, pictureBox1.Location.Y - 1);
}
if (e.KeyCode == Keys.Down)
{
pictureBox1.Location = new Point(pictureBox1.Location.X, pictureBox1.Location.Y + 1);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (pictureBox2.Location==pictureBox1.Location)
{
Random x = new Random();
Random y = new Random();
pictureBox2.Location = new Point(x.Next(0, 550), y.Next(0, 490));
}
label1.Text = pictureBox1.Location.X.ToString();
label2.Text = pictureBox1.Location.Y.ToString();
label3.Text = pictureBox2.Location.X.ToString();
label4.Text = pictureBox2.Location.Y.ToString();
if (pictureBox1.Location.X == pictureBox2.Location.X && pictureBox1.Location.Y == pictureBox2.Location.Y)
{
timer1.Stop();
DialogResult dialogResult = MessageBox.Show("Hedefi yediniz kalmak istiyor musunuz ?", "Giriş", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
++skor;
skor = int.Parse(label6.Text);
}
else if (dialogResult == DialogResult.No)
{
Application.Exit();
}
if (pictureBox1.Location.Y < -5)
{
timer1.Enabled = false;
MessageBox.Show(" nereye");
}
Kaydol:
Kayıt Yorumları (Atom)
c# Veritabanıyla giriş yapıp, üye olmak ve şifre unutmak!
Üye olmak;;; if (con.State == ConnectionState.Closed) { con.Open(); string kayit = ...
-
Merhaba TextBox'tan alınan sayının 10'a bölünen değerlerini bulacağız. Öncellikle ihtiyacımız olan 3 TextBox , 3 ListBox ve bir d...
-
Merhaba arkadaşlar bugün bilgisayardan fotoğraf çekmeyi göstereceğim. Bunun için ihtiyacımız olan bir picturebox ve button; OpenFi...
-
Herkese selamlar; Bugun buttonunuz rengini nasıl değiştireceğinizi göstereceğim. Bu işlemi ben radioButton ile yapmayı tercih ediyorum. ...
Hiç yorum yok:
Yorum Gönder