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");
}
7 Ocak 2019 Pazartesi
3 Ocak 2019 Perşembe
c# Form Basit modlama örneği
private void umut (int sayi1, int sayi2)
{
int sonuc = sayi1 * sayi2;
MessageBox.Show(sonuc.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
int sa = int.Parse(textBox1.Text);
int ass = int.Parse(textBox2.Text);
umut(sa, ass);
}
{
int sonuc = sayi1 * sayi2;
MessageBox.Show(sonuc.ToString());
}
private void button1_Click(object sender, EventArgs e)
{
int sa = int.Parse(textBox1.Text);
int ass = int.Parse(textBox2.Text);
umut(sa, ass);
}
c# Form Random üretilmiş dizi de ki en büyük sayıyı bulmak
int[] dizi = new int[50];
Random rasgale = new Random();
int eb = 0;
for (int i = 0; i < 50; i++)
{
dizi[i] = rasgale.Next(1, 100);
if (dizi[i] > eb)
{
eb = dizi[i];
listBox1.Text = eb.ToString();
}
Random rasgale = new Random();
int eb = 0;
for (int i = 0; i < 50; i++)
{
dizi[i] = rasgale.Next(1, 100);
if (dizi[i] > eb)
{
eb = dizi[i];
listBox1.Text = eb.ToString();
}
c# Form Matematik İşlemi
double sayi1 = double.Parse(textBox1.Text);
double sayi2 = double.Parse(textBox2.Text);
double sonuc = Math.Pow(sayi1,sayi2);
MessageBox.Show(sonuc.ToString());
double sayi2 = double.Parse(textBox2.Text);
double sonuc = Math.Pow(sayi1,sayi2);
MessageBox.Show(sonuc.ToString());
Kaydol:
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. ...