Arkadaşlar bu başlık altında örnek kodlarımızı ve bitmiş projelerimizi paylaşalım.
İlk kod benden basit bir uygulama; textbox1'e girilen bir metni (büyük harf veya küçük harf farketmez) formatla butonuna bastığınız anda textbox2 ye baş harfi büyük kalacak şekilde diğer harflerini küçük harfe çevirerek yazıyor.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Buyuk_Harf_Caliimasi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string CumleFormatla(string cumle)
{
string sentence = cumle;
char[] ayrac = new char[] {' '};
string[] kelimeler = sentence.Split(ayrac);
string[] formatli = new string[kelimeler.Length];
int sayac=0;
foreach (string kelime in kelimeler)
{
//her bir kelimeden itibaren bir karekter al.
string ilkHarf = kelime.Substring(0, 1);
//birnci karekterden sonra hepsini al.
string geriyeKalan = kelime.Substring(1);
ilkHarf = ilkHarf.ToUpper();
geriyeKalan = geriyeKalan.ToLower();
formatli[sayac] = ilkHarf + geriyeKalan;
sayac++;
}
string yeniCumle= string.Join(" ", formatli);
return yeniCumle;
}
private voıd button1_Click(object sender, EventArgs e)
{
textBox2.Text= CumleFormatla(textBox1.Text);
}
}
}
_________________________________
_________________________________
Yarış uygulaması
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Yarıs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private **** comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
int maxHiz;
int hızHoroz;
int hızköpek;
int hızkedi;
Random rnd = new Random();
private **** Form1_Load(object sender, EventArgs e)
{
}
private **** btnBaslat_Click(object sender, EventArgs e)
{
string secilen = cmbPist.SelectedItem.ToString();
if (secilen == "Kum Pist")
{
maxHiz = 25;
}
if (secilen == "Çim Pist")
{
maxHiz = 50;
}
if (secilen == "Toprak Pist")
{
maxHiz = 75;
}
tmrStart.Interval = 500;
tmrStart.Start();
}
private **** tmrStart_Tick(object sender, EventArgs e)
{
if (pbHoroz.Left >= 600)
{
tmrStart.Stop();
MessageBox.Show("horoz kazandı");
}
if (pbKedi.Left >= 600)
{
tmrStart.Stop();
MessageBox.Show("kedi kazandı");
}
if (pbKöpek.Left >= 600)
{
tmrStart.Stop();
MessageBox.Show("köpek kazandı");
}
hızHoroz = rnd.Next(0, maxHiz);
hızkedi = rnd.Next(0, maxHiz);
hızköpek = rnd.Next(0, maxHiz);
pbHoroz.Left += hızHoroz;
pbKedi.Left += hızkedi;
pbKöpek.Left += hızköpek;
}
}
}
_________________________
_________________________
using System;
class cRypto
{
char ch1='X', ch2='Y';
key =31;
Console.WriteLine("Orjinal metinmiz = "+ch1+ch2);
ch1 = (char)(ch1^key);
ch2= (char)(ch2^key);
Console.WriteLine("Kriptolanmış hali "+ch1+ch2);
ch1 = (char)(ch1^key);
ch2= (char)(ch2^key);
Console.WriteLine("DeCrypt hali "+ch1+ch2);
}
herkes crpyto ile ilgilenebilir eer isteyen olrsa daha ileri düzeyleri paylaşrm saygı selamlar ixan//////
İlk kod benden basit bir uygulama; textbox1'e girilen bir metni (büyük harf veya küçük harf farketmez) formatla butonuna bastığınız anda textbox2 ye baş harfi büyük kalacak şekilde diğer harflerini küçük harfe çevirerek yazıyor.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Buyuk_Harf_Caliimasi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public string CumleFormatla(string cumle)
{
string sentence = cumle;
char[] ayrac = new char[] {' '};
string[] kelimeler = sentence.Split(ayrac);
string[] formatli = new string[kelimeler.Length];
int sayac=0;
foreach (string kelime in kelimeler)
{
//her bir kelimeden itibaren bir karekter al.
string ilkHarf = kelime.Substring(0, 1);
//birnci karekterden sonra hepsini al.
string geriyeKalan = kelime.Substring(1);
ilkHarf = ilkHarf.ToUpper();
geriyeKalan = geriyeKalan.ToLower();
formatli[sayac] = ilkHarf + geriyeKalan;
sayac++;
}
string yeniCumle= string.Join(" ", formatli);
return yeniCumle;
}
private voıd button1_Click(object sender, EventArgs e)
{
textBox2.Text= CumleFormatla(textBox1.Text);
}
}
}
_________________________________
_________________________________
Yarış uygulaması
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Yarıs
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private **** comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
int maxHiz;
int hızHoroz;
int hızköpek;
int hızkedi;
Random rnd = new Random();
private **** Form1_Load(object sender, EventArgs e)
{
}
private **** btnBaslat_Click(object sender, EventArgs e)
{
string secilen = cmbPist.SelectedItem.ToString();
if (secilen == "Kum Pist")
{
maxHiz = 25;
}
if (secilen == "Çim Pist")
{
maxHiz = 50;
}
if (secilen == "Toprak Pist")
{
maxHiz = 75;
}
tmrStart.Interval = 500;
tmrStart.Start();
}
private **** tmrStart_Tick(object sender, EventArgs e)
{
if (pbHoroz.Left >= 600)
{
tmrStart.Stop();
MessageBox.Show("horoz kazandı");
}
if (pbKedi.Left >= 600)
{
tmrStart.Stop();
MessageBox.Show("kedi kazandı");
}
if (pbKöpek.Left >= 600)
{
tmrStart.Stop();
MessageBox.Show("köpek kazandı");
}
hızHoroz = rnd.Next(0, maxHiz);
hızkedi = rnd.Next(0, maxHiz);
hızköpek = rnd.Next(0, maxHiz);
pbHoroz.Left += hızHoroz;
pbKedi.Left += hızkedi;
pbKöpek.Left += hızköpek;
}
}
}
_________________________
_________________________
using System;
class cRypto
{
char ch1='X', ch2='Y';
key =31;
Console.WriteLine("Orjinal metinmiz = "+ch1+ch2);
ch1 = (char)(ch1^key);
ch2= (char)(ch2^key);
Console.WriteLine("Kriptolanmış hali "+ch1+ch2);
ch1 = (char)(ch1^key);
ch2= (char)(ch2^key);
Console.WriteLine("DeCrypt hali "+ch1+ch2);
}
herkes crpyto ile ilgilenebilir eer isteyen olrsa daha ileri düzeyleri paylaşrm saygı selamlar ixan//////